Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Table Locks Adding Foreign Keys

RE: Table Locks Adding Foreign Keys

From: Mercadante, Thomas F <thomas.mercadante_at_labor.state.ny.us>
Date: Wed, 6 Oct 2004 13:13:59 -0400
Message-ID: <C9995D8C5E0DDA4A8FF9D68EE666CE07A7F943@exchsen0a1ma>


Todd,

Think of it as a long-running query on the parent table. It should not throw any locks.

I also agree with Mladen. Create the Fk with the 'enable novalidate' option. It will create the FK immediately with no further processing. The only downside of this is that existing records will not have this column validated. If the column is empty, then you are fine. If it is not empty, you can run your own queries against the table to see if all of the values are valid. I think I would do this to ensure that the values are valid anyway before I applied the FK constraint.

Good Luck!

Tom Mercadante
Oracle Certified Professional

-----Original Message-----

From: todd.sheetz_at_aurora.org [mailto:todd.sheetz_at_aurora.org] Sent: Wednesday, October 06, 2004 12:49 PM To: oracle-l_at_freelists.org
Subject: Table Locks Adding Foreign Keys

This probably has a very easy answer, but I can't seem to find it. I have a 260 million row table that I need to add a foreign key constraint to that references another table with 30 million rows. Will adding the constraint cause any locking during the time the constraint is being validated? This is a vendor application and they are telling us that we can run this while users are in the system. I have some doubt about whether this would place at least a share lock on the table. Any information is appreciated.

Thanks

Todd

--

http://www.freelists.org/webpage/oracle-l
--

http://www.freelists.org/webpage/oracle-l Received on Wed Oct 06 2004 - 12:10:17 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US