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

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 17:29   2509   0

下午收到同事的报告,一张表被错误更新,没有加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 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP