Drop foreign key constraint

lium1
lium1 used Ask the Experts™
on
SQL ERROR: ORA-04021: timeout occurred while waiting to lock object.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015

Commented:
The corresponding table could not be locked within the time allowed.

Author

Commented:
I meant how to solve this issue. I am trying to add constraint foreign_key with enable and validate where I got an timeout error.
"Batchelor", Developer and EE Topic Advisor
Top Expert 2015
Commented:
Since you want to have the FK validated, it needs to go thru both this and the referred table to check the constraint. You won't get that to succeed for heavy used tables (when updating/inserting a lot).
Not requesting validation is one option. Better to check manually later for mismatches - you'll have to correct them anyway, and it is better to have the FK ensured for future changes than not at all.
Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015

Commented:
"You can't do that" can be a valid and appropriate answer. If there is no way, there is none.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial