0%

ORA-02429 cannot drop index used for enforcement of unique/primary key.

ORA-02429: cannot drop index used for enforcement of unique/primary key.

刪除index時,出現錯誤訊息 ORA-02429: cannot drop index used for enforcement of unique/primary key.

要刪除的index 上面有相依的Constraint(primary key)

原因是在建立primary key時,使用了Using Index將primary key綁定在index上
舉例:

1
2
ALTER TABLE  table_name ADD CONSTRAINT pk_key  PRIMARY KEY ("columnName")
USING INDEX index_name ENABLE;

若要刪除這個 index 的話需要先移除這個Constraint,再刪除index就可以了。
解法:

1
ALTER TABLE table_name DROP CONSTRAINT pk_key DROP INDEX;

參考連結:

  1. 如何理解 Using INDEX https://blog.csdn.net/w892824196/article/details/89510942