Guest User | Contact

Frequently Asked Questions

How to Disable all constraints

Useful script for disabling all constraints.

set feedback off 
set verify off 
set echo off 
prompt Finding constraints to disable... 
set termout off 
set pages 80 
set heading off 
set linesize 120 
spool tmp_disable.sql 
select 'spool igen_disable.log;' from dual; 
select 'ALTER TABLE '||substr(c.table_name,1,35)|| 
' DISABLE CONSTRAINT '||constraint_name||' ;' 
from user_constraints c, user_tables u 
where c.table_name = u.table_name; 
select 'exit;' from dual; 
set termout on 
prompt Disabling constraints now... 
set termout off 
Now execute following pl/sql block.

 for rec in (select * from user_constraints) loop 
 execute immediate 'alter table ' || rec.table_name || ' disable 
constraint ' || rec.constraint_name; 
 end loop; 

You can change above script as per your requirements.

 Last updated Tue, Sep 29 2015 10:46am

Please Wait!

Please wait... it will take a second!