Oracle入门基础
使用SQLplus工具登录连接
开始-》运行CMD-》 C:\Users\Admininstrator> sqlplus 请输入用户名:sys@orcl as sysdba
输入口令:root SQL> 或者直接输入 sqlplus sys/root@orcl as sysdba 进入
查询当前用户
SQL>show user;
启用被锁定的用户username
SQL> alter user username account unlock;
创建表空间 (默认永久数据文件为xx.dbf,设置大小为100M,每次自增涨100M,TEMPFILE表示零时数据文件,根据需要而定)
SQL>CREATE [TEMPORARY] TABLESPACE tablespace_name TEMPFILE | DATAFILE 'xx.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED
查看表空间的信息(注意大小写)
SQL>SELECT * FROM dba_data_files WHERE TABLESPACE_NAME=‘TEST';
修改表空间的状态(联机或者脱机)
SQL>ALTER TABLESPACE tablesapce_name ONLINE | OFFLINE
查询表空间的状态
SQL>SELECT status from dba_tablespaces WHERE tablespace_name = 'spacename';
删除表空间(选项为删除表空间的同时删除数据文件)
SQL>DROP TABLESPACE tablespace_name [INCLUDING CONTENTS]
创建用户(需要有创建用户的权限)
创建一个用户名为test的用户,密码为password,默认表空间为A,零时表空间为B
SQL>create user test identified by password default tablespace A temporary tablespace B;
删除用户
SQL>drop user testl;
给表空间授权
grant create session to test; //授予test用户创建session的权限,即登陆权限
grant unlimited tablespace to test; //授予test用户使用表空间的权限
grant create tablespace to test; //授予test用户创建表空间的权限
grant alter tablespace to test; //授予test用户修改表空间的权限
grant drop tablespace to test; //授予test用户删除表空间的权限
grant manage tablespace to test; //授予test用户管理表空间的权限
grant create table to test; //授予创建表的权限(包含有create index权限, alter table, drop table权限)
grant create view to test; //授予用户操作视图的权限(包含有alter view, drop view权限)
grant create trigger to test; //授予用户操作触发器的权限(包含有alter trigger, drop trigger权限)
grant create procedure to test; //授予用户操作存储过程的权限(包含有alter procedure, drop procedure 和function 以及 package权限)
grant create sequence to test; //授予用户操作序列的权限:(包含有创建、修改、删除以及选择序列)
grant select any dictionary to test; //允许从sys用户所拥有的数据字典表中进行选择
Oracle入门基础的更多相关文章
- Oracle入门基础(1)
1.数据库系统和数据管理系统的区别? 数据库系统=数据库的管理系统+oper操作员+硬件 2.Oracle的版本 8i /9i 10g/11g 12c(cloud) 3.Oracle主要组 ...
- Oracle入门基础(十三)一一java调用oracle存储过程
package demo; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.ResultS ...
- Oracle入门基础(十)一一数据库其他对象-视图/序列/索引/同义词
SQL> --视图 SQL> create view empinfoview as select e.empno,e.ename,e.sal,e.sal*12 annsal,d.dname ...
- Oracle入门基础(八)一一数据处理
SQL> SQL的类型 SQL> 1.DML(Data Manipulation Language 数据操作语言): select insert update delete SQL> ...
- Oracle入门基础(十二)一一储存过程及触发器
1.第一个存储过程 打印Hello World 调用存储过程: 1.exec sayhelloworld(); 2.begin sayhelloworld(); sayhelloworld(); en ...
- Oracle入门基础(十一)一一PL/SQL基本语法
1.打印Hello World declare --说明部分 begin --程序 dbms_output.put_line('Hello World'); end; 2.引用型变量 查询并打印783 ...
- Oracle入门基础(九)一一创建表和管理表
练习:查询每一年入职人数及总人数 SQL> select count(*) Total, 2 sum(decode(to_char(hiredate,'yyyy'),'1980',1,0)) & ...
- Oracle入门基础(七)一一集合运算
SQL> /* SQL> 查询10和20号部门的员工 SQL> 1. select * from emp where deptno=10 or deptno=20; SQL> ...
- Oracle入门基础(六)一一子查询
SQL> --查询工资比SCOTT高的员工信息 SQL> --1. SCOTT的工资 SQL> select sal from emp where ename='SCOTT'; SA ...
随机推荐
- AngularJS 细节
AngularJS 表达式({{ expression }})类似于 AngularJS ng-bind 例子: <span>表达式</span> <div ng-app ...
- Docker命令详解
Docker命令详解 最近学习Docker,将docker所有命令实验了一番,特整理如下: # docker --help Usage: docker [OPTIONS] COMMAND [arg ...
- rmarkdown教程
https://github.com/yihui/r-ninja/blob/master/11-auto-report.md http://rpubs.com/about/getting-starte ...
- MySQL 新装数据库不能链接解决方法
在my.ini的[mysqld]字段加入: skip-grant-tables 重启mysql服务,这时的mysql不需要密码即可登录数据库 然后进入mysql mysql>use mysql; ...
- zabbix3 设置邮件报警(五)
Zabbix邮件报警配置 一.安装sendmail或者postfix(安装一种即可) yum install sendmail #安装 service sendmail start #启动 chkco ...
- GNU Radio Radar Toolbox
GNU Radio Radar Toolbox Install guide Change to any folder in your home directory and enter followin ...
- 微信小程序内训笔记
2016年9月22日凌晨微信官方正式宣布“小程序”开始内测,有“微信之父”之称.腾讯集团高级执行副总裁张小龙在2016年末对外宣布“小程序“应用将于2017年1月9日正式推出 这一次微信还是按照惯例, ...
- excel to datatable (c#用NPOI将excel文件内容读取到datatable数据表中)
将excel文件内容读取到datatable数据表中,支持97-2003和2007两种版本的excel 1.第一种是根据excel文件路径读取excel并返回datatable /// <sum ...
- PHP之compact()函数
PHP之compact()函数 compact()函数将变量转化为数组: <?php //直接调用函数 $a=1;$b=3;$c=4; var_dump($a,$b,$c); //自定义函数实现 ...
- basic use of sidekiq (2)
vim Gemfile source "https://rubygems.org" gem "sidekiq"gem 'rack-protection' gem ...