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

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.