您的位置:首页 > 数据库 > Oracle

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

2010-07-22 11:07 836 查看
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;

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: