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: Disable/Enable scripts?

Re: Disable/Enable scripts?

From: Thiru Pandian <tpandian_at_gmail.com>
Date: Thu, 23 Dec 2004 21:15:00 -0500
Message-ID: <1d23e2cc04122318157a6e679f@mail.gmail.com>


this is what we use

set pagesize 0
set verify off
set trimspool on
set feed off
column file_name new_value spoolfile
select lower(substr(global_name,1,instr(global_name,'.WORLD')-1))||'_'||lower(us er) ||'_enable_cons.sql'
 file_name from global_name;
spool &&spoolfile
select 'alter table '|| table_name || ' enable constraint ' ||' ' || constraint_name ||';' from user_constraints where constraint_type in ('R','U','P')
order by decode(constraint_type,'R',2,'U',1,'P',0);

to disable change the query like below and change the enable to disable in top portion.

where constraint_type in ('R','U','P')
and status ='ENABLED'
order by decode(constraint_type,'R',0,'U',1,'P',2);

On Thu, 23 Dec 2004 11:48:52 -0700, Bryan Wells <bunjibry_at_gmail.com> wrote:
> 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_at_gmail.com
> --
> http://www.freelists.org/webpage/oracle-l
>

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Dec 23 2004 - 20:10:18 CST

Original text of this message

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