--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'
select 'drop sequence ' || sequence_name || ';'
from dba_sequences
where sequence_owner = '用户名';
select 'create sequence ' || sequence_name ||
' minvalue ' || min_value ||
' maxvalue ' || max_value ||
' start with ' || last_number ||
' increment by ' || increment_by ||
(case
when cache_size = 0 then
' nocache'
else
' cache ' || cache_size
end) || ';'
from dba_sequences where sequence_owner = '用户名'
--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'
select 'drop sequence ' || sequence_name || ';'
from dba_sequences
where sequence_owner = '用户名';
select 'create sequence ' || sequence_name ||
' minvalue ' || min_value ||
' maxvalue ' || max_value ||
' start with ' || last_number ||
' increment by ' || increment_by ||
(case
when cache_size = 0 then
' nocache'
else
' cache ' || cache_size
end) || ';'
from dba_sequences where sequence_owner = '用户名'