oracle基本操作
2019-08-17 21:05
1511 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_38325614/article/details/99696225
1.用户和表空间
- 查看当前用户
show user;
- 锁定/解锁用户 (lock:锁定/unlock:解锁)
alter user 'username' account lock/unlock;
- 查看用户表空间 (查看系统用户表空间将user_tablespaces换为dba_tablespaces)
select tablespace_name from user_tablespaces;
- 创建表空间
create tablespace tablespace_name datafile 'test1_tablespace.dbf' size 10m;
- 创建临时表空间
create temporary tablespace tablespace_name tempfile 'temptest1_tablespace.dbf' size 10m;
- 查看表空间存放位置
select file_name from dba_data_files where tablespace_name = 'tablespace_name';
- 查看临时表空间存放位置
select file_name from dba_temp_files where tablespace_name = 'tablespace_name';
- 查看用户使用的默认表空间和临时表空间
select default_tablespace,temporary_tablespace from dba_users where username = 'username';
- 更改用户默认表空间
alter user username default tablespace tablespace_name;
- 修改表空间的状态(online:联机/offline:脱机)
alter tablespace tablespace_name online/offline;
- 查看表空间的状态
select status from dba_tablespace where tablespace_name = 'TABLESPACE_NAME';
- 设置表空间只读/可读写 (默认是可读写,表空间必须是联机状态才能设置)
alter tablespace tablespace_name read only/read write
- 添加表空间的数据文件
alter tablespace tablespace_name add datafile 'filename.dbf' size 5m;
- 删除表空间的数据文件(不可以删除创建表空间时创建的数据文件,如果要删除需要将整个表空间删除)
alter tablespace tablespace_name drop datafile 'filename.dbf';
- 删除表空间 (如果要删除数据文件在末尾加上 including contents)
drop tablespace tablespace_name [including contents];
相关文章推荐
- Oracle 基本操作
- oracle基本操作语句
- ORACLE基本定义、操作语句
- Oracle下SQL基本操作(一)
- ORACLE SQL*PLUS 基本操作(一)
- 浅谈Oracle 11g 发行版2 新安装后关于登录的一些基本操作
- ORACLE基本操作命令:
- oracle基本操作语句
- oracle基本操作
- Oracle ,DB2和mysql基本操作命令
- Oracle 12c下的一些基本操作(更新)
- Oracle-基本操作
- Oracle 表空间基本操作
- Oracle基本数据库操作
- oracle基本操作问题
- oracle基本操作,自己亲手做过了
- oracle sqlplus基本操作
- oracle 11g asm 基本操作
- ORACLE分区表的基本操作
- Oracle数据的基本操作