Oracle 删除表空间

-删除空的表空间,但是不包含物理文件
drop tablespace tablespace_name;
--删除非空表空间,但是不包含物理文件
drop tablespace tablespace_name including contents;
--删除空表空间,包含物理文件
drop tablespace tablespace_name including datafiles;
--删除非空表空间,包含物理文件
drop tablespace tablespace_name including contents and datafiles;
--如果其他表空间中的表有外键等约束关联到了本表空间中的表的字段,就要加上CASCADE CONSTRAINTS
drop tablespace tablespace_name including contents and datafiles CASCADE CONSTRAINTS;

Oracle数据库中删除了表空间物理文件XXX.ora后导致用drop tablespace删除表空间失败,解决方法如下:

 用sqlplus /nolog命令进入oracle数据库执行如下命令:
  sql>conn /as sysdba;
  sql>startup;(如果数据库已启动则不需要此命令)
  sql>alter database datafile ''/home/oracle/XXX.ora'' offline drop;(/home/oracle/XXX.ora为表空间文件的物理路径)
  sql>drop tablespace XXX;

执行完后,重启数据库即可。

转载:https://www.cnblogs.com/klb561/p/11062247.html

原文地址:https://www.cnblogs.com/cjybarcode/p/14518077.html