Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Disable/Enable scripts?
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-lReceived on Thu Dec 23 2004 - 20:10:18 CST
![]() |
![]() |