1、ORACLE數據庫中的外鍵約束名都在表user_constraints中可以查到。其中constraint_type='R'表示是外鍵約束。
2、啟用外鍵約束的命令為:alter table table_name enable constraint constraint_name
3、禁用外鍵約束的命令為:alter table table_name disable constraint constraint_name
4、然后再用SQL查出數據庫中所以外鍵的約束名:
select 'alter table '||table_name||' enable constraint '||constraint_name||';' from user_constraints where constraint_type='R'
select 'alter table '||table_name||' disable constraint '||constraint_name||';' from user_constraints where constraint_type='R'