oracle刪除數據庫中的所有表

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 'alter table ' || table_name || ' enable constraint ' ||
constraint_name || ';'
from user_constraints
where constraint_type = 'R';
執行所有約束啓用命令。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章