搜鞥都哦 发表于 2018-9-14 09:45:06

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';
  执行所有约束启用命令。

页: [1]
查看完整版本: oracle删除数据库中的所有表