Chinese:
ORA-02429: can not be used to force delete unique index / primary key
Cause: The
user tries to delete used to force a unique / primary key index
because the index is the primary key constraint created automatically after creation, so delete the index is not possible, so in order to delete the index need to delete the primary key, then the index will be delete
Solution:
After not directly delete an index, but directly delete primary key constraint, delete the primary key constraint, the index will be automatically deleted
Example:
1) create a test table
CREATE TABLE TAB_TEST ( ID VARCHAR2(20 BYTE), NAME VARCHAR2(20 BYTE), CITY VARCHAR2(10 BYTE) )
2) create a primary key constraint
ALTER TABLE TAB_TEST ADD CONSTRAINT PK_TAB_TEST PRIMARY KEY (ID,NAME)
3) the query constraints and indexes
The SELECT CONSTRAINT_NAME the FROM the DBA_CONSTRAINTS the WHERE TABLE_NAME = ' TAB_TEST ' - primary key constraint created to return the SELECT INDEX_NAME is the FROM DBA_INDEXES the WHERE TABLE_NAME = ' TAB_TEST ' - creating primary key constraint, the index is created
4) delete the index
DROP INDEX PK_TAB_TEST - error, ORA-02429: unable to delete indexes to enforce unique / primary key
5) Delete the primary key constraint
ALTER TABLE TAB_TEST DROP CONSTRAINT PK_TAB_TEST
6) the query constraints and indexes
The SELECT CONSTRAINT_NAME the FROM the DBA_CONSTRAINTS the WHERE TABLE_NAME = ' TAB_TEST ' - No records are returned, the primary key constraint is deleted to create the SELECT INDEX_NAME is the FROM DBA_INDEXES the WHERE TABLE_NAME = ' TAB_TEST ' - No records are returned, the primary key constraint is removed, the index is deleted