Oracle中删除所有外键约束、禁用约束、启用约束

1.禁用所有外键约束

select 'alter table '||table_name||' disable constraint '||constraint_name||';' from user_constraints where constraint_type='R';

 2.启用所有外键约束

select 'alter table '||table_name||' enable constraint '||constraint_name||';' from user_constraints where constraint_type='R';

 3.删除所有外键约束 

select 'alter table '||table_name||' drop constraint '||constraint_name||';' from user_constraints where constraint_type='R';

 

执行完所需要的语句后全部选中,一次执行即可达到想要的效果。

猜你喜欢

转载自840536410.iteye.com/blog/2053206