oracle 10g drop table 的闪回(相当于一个回收站和日志没啥关系)

来源:互联网 发布:淘宝里面怎么办信用卡 编辑:程序博客网 时间:2024/04/30 10:07

oracle 10g drop table 的闪回   --绝对的功臣


oracle 10g 在增加了闪回功能后,drop后的表被放在回收站(user_recyclebin)里,而不是直接删除掉。这样,回收站里的表信息就可以被恢复,或彻底清除。

1.通过查询回收站user_recyclebin获取被删除的表信息,

select * from user_recyclebin;

然后使用语句
flashback table <user_recyclebin.object_name or user_recyclebin.original_name> to before drop [rename to <new_table_name>];
将回收站里的表恢复为原名称或指定新名称,表中数据不会丢失。

例如:flashback table test1 to before drop rename to test2; --【to test2】将表重命名
若不想重命名,则直接运行命令:flashback table test1 to before drop

若要彻底删除表,则使用语句:drop table <table_name> purge;

2.清除回收站里的信息
清除指定表:purge table <table_name>;
清除当前用户的回收站:purge recyclebin;
清除所有用户的回收站:purge dba_recyclebin;

原创粉丝点击