报错现象:
drop tablespace users including contents and datafiles;
报错:
ORA-02429: cannot drop index used for enforcement of unlque/primary key
处理办法:
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');
然后将脚本提取执行删除操作
相关参考:
Drop Tablespace Failed with ORA-02429: cannot drop index used for enforcement of unique/primary key (文档 ID 1918060.1)