When the SQL Execution fails, the prompt is displayed again: ora-02429: Unable to delete the index that is used to force a unique/primary key, sqlora-02429
SQL 1: select segment_name, partition_name, tablespace_name from
-- The tablespace that displays the primary key of the table is: SYSTEM
-- The following is a script to delete the primary key constraint.
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 = 'system ');
-- The query result contains two pieces of data, which is the name of the constraint I created.
Alter table SYSTEM. COST_LFS drop constraint COST_ID_PK_LFS;
Alter table SYSTEM. COST drop constraint COST_ID_PK;
Execute the above two Display Results
Alter table SYSTEM. COST_LFS drop constraint COST_ID_PK_LFS;
Table SYSTEM. COST_LFS has been changed.
Alter table SYSTEM. COST drop constraint COST_ID_PK;
Table SYSTEM. COST has been changed.
Then, disconnect the database connection, or refresh the index. The two constraints have been deleted and the problem is solved.