Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Primary key constraint disable -enable problem solution

Fazlul Kabir MahfuzApr 24 2012 — edited Apr 24 2012
HI
recently i have truncate some table. during the truncate process i have face below problem and solve as below way,

SQL> TRUNCATE TABLE USER_STATE;
TRUNCATE TABLE USER_STATE
*
ERROR at line 1:
ORA-02266: unique/primary keys in table referenced by enabled foreign keys

Then i have find the related CONSTRAINT on the table as per 434169


SQL> ALTER TABLE USER_STATE_PARAMETER disable CONSTRAINT FK1_USR_SES_ST_PAR;

Table altered.

SQL> ALTER TABLE USER_STATE disable CONSTRAINT SYS_C0030849;

Table altered.

Then successfully truncate the table as below

SQL> TRUNCATE TABLE USER_STATE;

Table truncated.

then i have enable the CONSTRAINT

SQL> ALTER TABLE USER_STATE enable CONSTRAINT SYS_C0030849;

Table altered.

SQL> ALTER TABLE USER_STATE_PARAMETER enable CONSTRAINT FK1_USR_SES_ST_PAR;

Table altered.


---My Question is, after disable the CONSTRAINT, I did the truncate operation then I enable the CONSTRAINT. Is there anything I need to do which will make me confident to not face any problem during database DML OPERATION? i also found there is no disable CONSTRAINT in my database.
This post has been answered by unknown-7404 on Apr 24 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 22 2012
Added on Apr 24 2012
3 comments
12,323 views