首页 / 数据库 / MySQL / Drop user cascade failed ORA-00604 ORA-02429 处理一例
在删除索引、表、或者表空间及用户等数据库对象或者用户的时候,有时候会遇到入下错误:SQL> drop user Oracle cascade;
drop user oracle cascade;
*
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
我们知道drop user 带cascade会将所属的表空间和其他关联数据库对象一起删除,而这也说明正要被删除的对象和其他对象之间存在主外键约束关联的问题,所以需要查询该对象存在哪些约束并删除之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 onwner = "ORACLE");
alter table w.table_name drop constraint PK_ID ;
alter table x.table_name drop constraint FK_UID ;
SQL> alter table w.table_name drop constraint pk_id;
table altered
SQL>alter table x.table_name drop constraint fk_uid;