--禁用所有外键
select /*+ all_rows */ 'alter table ' || t.table_name || ' disable constraint ' || t.constraint_name || '; ' as SQLS from user_constraints u,
(select uc.table_name,uc.constraint_name ,uc.r_constraint_name from user_constraints uc where uc.constraint_type='R' ) t
where t.r_constraint_name=u.constraint_name
order by t.table_name;
--启用所有外键
select /*+ all_rows */ 'alter table ' || t.table_name || ' enable constraint ' || t.constraint_name || '; ' as SQLS from user_constraints u,
(select uc.table_name,uc.constraint_name ,uc.r_constraint_name from user_constraints uc where uc.constraint_type='R' ) t
where t.r_constraint_name=u.constraint_name
order by t.table_name;