Below are scripts that we will use in our environment before import the data using impdp inorder to speed up the process by disabling the constraints and triggers.
CONSTRAINTS DISABLE
——————-
Set linesize 300
Spool COnstraints_disable.sql
select ‘alter table ‘ || owner || ‘.’ || table_name || ‘ disable constraint ‘ || constraint_name || ‘;’ from all_constraints where owner=’test_schema’;
CONSTRAINTS ENABLE
——————-
SQL> set linesize 300
SQL> spool Constraints_enable.sql
SQL> select ‘alter table ‘ || owner || ‘.’ || table_name || ‘ enable constraint ‘ || constraint_name || ‘;’ from all_constraints where owner=’test_schema’;
Trigger Disable
—————
SQL> Set linesize 300
SQL> spool trigger_disable.sql
select ‘alter trigger ‘ || owner || ‘.’ || trigger_name || ‘ disable; ‘ from all_triggers where owner=’test_schema’;
Trigger Enable
—————
SQL> Set linesize 300
SQL> spool trigger_enable.sql
select ‘alter trigger ‘ || owner || ‘.’ || trigger_name || ‘ enable; ‘ from all_triggers where owner=’test_schema’;
UNLOCK_TABLE_STATISTICS
—————————
SQL > set linesize 300
SQL> Unlock_statistics.sql
select ‘exec DBMS_STATS.UNLOCK_TABLE_STATS(”’||owner||”’,”’||table_name||”’);’ from dba_tab_statistics where stattype_locked is not null and owner in(‘test_schema’);