Oracle删除表空间遇到的问题及解决(2)

对于ORA-02429这个错误,MOS文档的描述也很清楚:
Drop Tablespace Failed with ORA-02429: cannot drop index used for enforcement of unique/primary key (文档 ID 1918060.1)

现象:

删除表空间失败,伴随下面的错误:

SQL> DROP TABLESPACE REP_DATA INCLUDING CONTENTS AND DATAFILES; DROP TABLESPACE REP_DATA INCLUDING CONTENTS AND DATAFILES * ERROR at line 1: ORA-00604: error occurred at recursive SQL level 1 ORA-02429: cannot drop index used for enforcement of unique/primary key 解决方法:

Find the constraint name for the unique/primary key, disable the constraint and drop the tablespace again.
找到那些惟一/主键约束名,禁用这些约束然后再次删除表空间。

Steps: ===== 1) Execute below query to find the constraint name: 执行下面的查询来找到约束名: SQL> select owner, constraint_name,table_name,index_owner,index_name from dba_constraints where (index_owner,index_name) in (select owner,index_name from dba_indexes where tablespace_name='<tablespace_name>'); 2) Disable the constraint: 禁用约束: SQL> ALTER TABLE <table_name> DISABLE CONSTRAINT <constraint_name>; 3) Drop the tablespace: 删除表空间: SQL> DROP TABLESPACE <tablespace_name> INCLUDING CONTENTS AND DATAFILES; 问题3:表空间删除完毕,主机磁盘空间不释放

如果等待很长时间都没有释放,那么可参考:

建议的操作方法如下:
1、下载一个lsof软件装上,google上可以搜到
2、找到正在用被删文件的进程
lsof | grep deleted
3、kill掉相应的进程空间就释放了

一般这种情况,并不建议重启数据库或主机。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/2afa9436159966a93954368abde9d3be.html