RE: Disable/Enable scripts?

  • From: "Mercadante, Thomas F" <thomas.mercadante@xxxxxxxxxxxxxxxxx>
  • To: "'bunjibry@xxxxxxxxx'" <bunjibry@xxxxxxxxx>, Oracle-L <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 23 Dec 2004 14:14:45 -0500

Bryan

Yep.  You need to disable FK's before PK's

Try this:

Declare
Cursor c1 is
select 'alter table ' || table_name || ' disable constraint '
       || constraint_name sql_str
from user_constraints
where constraint_type in ('R','P')
order by constraint_type desc;
begin

for c1_rec in c1 loop

  execute immediate c1_rec.sql_str;

end loop;

end;
/


Change "Disable constraint" to "enable constraint" and you're all set for
enabling them.

Tom


-----Original Message-----
From: Bryan Wells [mailto:bunjibry@xxxxxxxxx] 
Sent: Thursday, December 23, 2004 1:49 PM
To: Oracle-L
Subject: Disable/Enable scripts?

All, Im looking for a script to Disable and enable constraints.  Is
there an order?  I would think the PK would need to be enabled first
then the FK.

Thanks for your help...

Happy Holidays!

-- 
DBA Newbie
bunjibry@xxxxxxxxx
--
//www.freelists.org/webpage/oracle-l
--
//www.freelists.org/webpage/oracle-l

Other related posts: