使用oracle 闪回查询找回误更新的数据

来源:互联网 发布:造价大师软件 安徽 编辑:程序博客网 时间:2024/04/30 22:29

下午收到同事的报告,一张表被错误更新,没有加where 导致表的某个字段被全部更新。数据已经提交。还好通知的及时,只要数据还在回滚段,就可以查到到,想到了闪回查询,下面是具体的操作步骤

create table t_test_1 as 
select * from  t_test  as of timestamp to_timestamp('2011-10-25 13:45:00','yyyy-mm-dd hh24:mi:ss');

select src from t_test_1;

.......................

10658103616692
10658103616692
10658103616692
10658103616692
10658103616692

...........................

数据不对,继续闪回

drop table t_test_1;

create table t_test_1 as 
select * from  t_test  as of timestamp to_timestamp('2011-10-25 13:30:00','yyyy-mm-dd hh24:mi:ss');

select src from t_test_1;

..................

10658103633081
10658103623000
106581036 16692
10658103616624
10658103616625
10658103616635

..........................

就是这些数据,下面进行重命名表的操作

rename t_test to t_test_2;
rename t_test_1 to t_test;

数据成功恢复。

0 0
原创粉丝点击