`
从此醉
  • 浏览: 1040605 次
  • 性别: Icon_minigender_1
  • 来自: US
社区版块
存档分类
最新评论

oracle误删数据恢复

 
阅读更多
一:表的恢复

对误删的表,只要没有使用PURGE永久删除选项,那么从flash back区恢复回来希望是挺大的。一般步骤有:

1、从flash back里查询被删除的表

select * from recyclebin

2.执行表的恢复

flashback table tb to before drop,这里的tb代表你要恢复的表的名称。

二:表数据恢复

对误删的表记录,只要没有truncate语句,就可以根据事务的提交时间进行选择恢复,一般步骤有:

1、先从flashback_transaction_query视图里查询,视图提供了供查询用的表名称、事务提交时间、UNDO_SQL等字段。

如:select * from flashback_transaction_query where table_name='TEST';
2、执行表记录恢复

一般先根据时间进行查询,查询语句模式为select * from tb as of timestamp to_timestamp(time,'yyyy-mm-dd hh24:mi:ss'); tb指表名称,time指某个时间点

如select * from scott.test as of timestamp to_timestamp('2009-12-11 20:53:57','yyyy-mm-dd hh24:mi:ss');

若有数据,恢复极为简单了,语句为flashback table tb to timestamp to_timestamp(time,'yyyy-mm-dd hh24:mi:ss');

如flashback table scott.test to timestamp to_timestamp('2009-12-11 20:47:30','yyyy-mm-dd hh24:mi:ss');
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics