暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

删除表空间报错ORA-02429

原创 jieguo 2024-01-15
1041

报错现象:

drop tablespace users including contents and datafiles;
报错:
ORA-02429: cannot drop index used for enforcement of unlque/primary key

image.png

处理办法:

1.先尝试:

drop tablespace users including contents and datafiles cascade constraints;

2.1不行,则继续查u/p:

根据sql查看需要删除的约束:
select 'alter table '||owner||'.'||table_name||' drop constraint '||constraint_name||' ;' from dba_constraints
where constraint_type in ('U', 'P') and (index_owner, index_name) in (select owner, segment_name from dba_segments where tablespace_name = 'USERS');
然后将脚本提取执行删除操作

2.2还有可能报错:

SQL> drop tablespace users including contents and datafiles;
drop tablespace users including contents and datafiles
*
第 1 行出现错误:
ORA-22868: 具有 LOB 的表包含有位于不同表空间的段

检查这个表空间上的Lob对象:
SQL> select owner, table_name, column_name, tablespace_name from dba_lobs where tablespace_name = 'USERS';
删除表后可继续。

2.3彻底一点,直接删表就行了:
select 'drop table '||owner||'.'||table_name||' purge;' from dba_tables where tablespace_name in('USERS');

相关参考:

Drop Tablespace Failed with ORA-02429: cannot drop index used for enforcement of unique/primary key (文档 ID 1918060.1)

最后修改时间:2024-01-15 15:06:05
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论