oracle commit之后的数据回滚

当你晕晕乎乎的执行了commit之后,突然间意思到自己点错了,那说明你和我碰到了一样的问题。

瞬间感觉大冷天头顶冒汗,那就说明你的感觉对了。废话少说,下面是我的办法:

下面的例子都是以Test表为例。

select
t.*,t.rowid from Test t;
-----执行了一堆命令
commit;
意识到自己点错了。

开始恢复了
select * from Test as of timestamp to_timestamp('2016-12-29 15:04:56','yyyy-mm-dd hh24:mi:ss');
上面的代码就可以查看你要恢复的时间点的记录,看看是不是你想要的记录。

能看到,剩下的就简单了,可以把现在表中的数据备份到一个临时表,然后把记录差插进去就行了

不要用truncate删除,不然你就回不去了,到时候你就要哭了!!!!!!!
delete from Test;
insert into Test select * from Test as of timestamp to_timestamp('2016-12-29 15:24:27','yyyy-mm-dd hh24:mi:ss');
commit;
原文地址:https://www.cnblogs.com/dragkiss/p/6233928.html