1.查询出所有表的唯一键约束的 禁用sql
select 'alert table ' || table_name || ' disable constraint '||constraint_name||';'
from user_constraints where constraint_type='U';
如下:
alert table SYENTINFO2 disable constraint UQ_SY20180806;
alert table WEB_INFO disable constraint UQWEBINFO201807211136;
alert table ENT_INFO_WUHAN disable constraint SYS_C0024733;
查询出所有表的唯一键约束的 启用sql
select 'alert table ' || table_name || ' enable constraint '||constraint_name||';'
from user_constraints where constraint_type='U';
如下:
alert table SYENTINFO2 enable constraint UQ_SY20180806;
alert table WEB_INFO enable constraint UQWEBINFO201807211136;
alert table ENT_INFO_WUHAN enable constraint SYS_C0024733;
如果需要查询外键
select 'alert table ' || table_name || ' enable constraint '||constraint_name||';'
from user_constraints where constraint_type='R';
select 'alert table ' || table_name || ' disable constraint '||constraint_name||';'
from user_constraints where constraint_type='U';
如下:
alert table SYENTINFO2 disable constraint UQ_SY20180806;
alert table WEB_INFO disable constraint UQWEBINFO201807211136;
alert table ENT_INFO_WUHAN disable constraint SYS_C0024733;
查询出所有表的唯一键约束的 启用sql
select 'alert table ' || table_name || ' enable constraint '||constraint_name||';'
from user_constraints where constraint_type='U';
如下:
alert table SYENTINFO2 enable constraint UQ_SY20180806;
alert table WEB_INFO enable constraint UQWEBINFO201807211136;
alert table ENT_INFO_WUHAN enable constraint SYS_C0024733;
如果需要查询外键
select 'alert table ' || table_name || ' enable constraint '||constraint_name||';'
from user_constraints where constraint_type='R';