1、先禁用數據庫中所有的約束
select 'alter table ' || table_name || ' disable constraint ' ||
constraint_name || ';'
from user_constraints
where constraint_type = 'R';
執行所有約束禁用命令。
2、清空所有表中的數據
select 'truncate table '||table_name||';' from user_tables;
執行所有的清表命令。
3、刪除所有表
select 'drop table '||table_name||';' as sqlscript from user_tables;
執行所有的刪除命令。
4、啟用數據庫中所有表的約束
select 'alter table ' || table_name || ' enable constraint ' ||
constraint_name || ';'
from user_constraints
where constraint_type = 'R';
執行所有約束啟用命令。
