Oracle 表空间【转载&整理】 oracle创建表空间、添加数据库文件

Oracle 删除用户和表空间

Oracle 使用时间长了, 新增了许多user 和tablespace. 需要清理一下

对于单个user和tablespace 来说, 可以使用如下命令来完成。

 步骤一:  删除user

drop user ×× cascade

说明: 删除了user,只是删除了该user下的schema objects,是不会删除相应的tablespace的。

步骤二: 删除tablespace

DROP TABLESPACE tablespace_name INCLUDING CONTENTS AND DATAFILES;

创建表空间:

create [undo|TEMPORARY]tablespace venn datafile '/opt/oracle/db01/app/oracle/oradata/OSSORCL/venn01.dbf'
size 10M
autoextend on next 100M
maxsize 500M [unlimited]  --最大32G
logging online permanent;  --一直在线
注:
1 、undo : 创建undo表空间
2、 temporary : 创建临时表空间

添加数据文件:

alter tablespace venn add datafile '/opt/oracle/db01/app/oracle/oradata/OSSORCL/venn02.dbf'
size 10M
autoextend on next 100M
maxsize 500M ;

 同时添加多个文件:

复制代码
alter tablespace venn add datafile '/opt/oracle/db01/app/oracle/oradata/OSSORCL/venn02.dbf'
size 10M
autoextend on next 100M
maxsize 500M,
'/opt/oracle/db01/app/oracle/oradata/OSSORCL/venn02.dbf'
size 10M
autoextend on next 100M
maxsize 500M ;
复制代码

删除表空间:

drop tablespace venn including contents and datafiles;

同时删除内容和数据库文件。

创建表空间:

create [undo|TEMPORARY]tablespace venn datafile '/opt/oracle/db01/app/oracle/oradata/OSSORCL/venn01.dbf'
size 10M
autoextend on next 100M
maxsize 500M [unlimited]  --最大32G
logging online permanent;  --一直在线
注:
1 、undo : 创建undo表空间
2、 temporary : 创建临时表空间

添加数据文件:

alter tablespace venn add datafile '/opt/oracle/db01/app/oracle/oradata/OSSORCL/venn02.dbf'
size 10M
autoextend on next 100M
maxsize 500M ;

 同时添加多个文件:

复制代码
alter tablespace venn add datafile '/opt/oracle/db01/app/oracle/oradata/OSSORCL/venn02.dbf'
size 10M
autoextend on next 100M
maxsize 500M,
'/opt/oracle/db01/app/oracle/oradata/OSSORCL/venn02.dbf'
size 10M
autoextend on next 100M
maxsize 500M ;
复制代码

删除表空间:

drop tablespace venn including contents and datafiles;

同时删除内容和数据库文件。

猜你喜欢

转载自www.cnblogs.com/gipagod/p/9766162.html