REM --  This script builds 2 scripts.
REM --  The first one is for disabling APPS, foreign key, integrity constraints.
REM --  The second one is for re-enabling APPS, foreign key, integrity constraints.
REM --
set linesize 120;
SET head off;
SET echo off;
SET pagesize 0;
SET feedback off;

SPOOL dis_constraints_work.sql;
SELECT 'ALTER TABLE ' ||
       owner ||
       '.' ||
       table_name ||
       ' DISABLE CONSTRAINT ' ||
       constraint_name ||
       ';' "ALTER Statement"
  FROM dba_constraints
 WHERE constraint_type = 'R'
   AND owner NOT IN
          ('SYSTEM', 'SYS')
/

SPOOL off;

SPOOL enab_constraints_work.sql;
SELECT 'ALTER TABLE ' ||
       owner ||
       '.' ||
       table_name ||
       ' ENABLE CONSTRAINT ' ||
       constraint_name ||
       ';' "ALTER Statement"
  FROM dba_constraints
 WHERE constraint_type = 'R'
   AND owner NOT IN
          ('SYSTEM', 'SYS')
/

SPOOL off;