Oracle 撤回已经提交的事务

在PL/SQL操作了一条delete语句习惯性的commit 了,因少加了where条件 导致多删了数据

1、查询视图v$sqlarea,找到操作那条SQL的时间(FIRST_LOAD_TIME

select r.FIRST_LOAD_TIME,r.* from v$sqlarea r order by r.FIRST_LOAD_TIME desc ;

  

 2、查询2021-01-28 08:58:08该时间点的表数据,看表格数据是否是执行delete语句之前的数据。

select * from 表名 as of timestamp to_timestamp('2021-01-28 08:58:08', 'yyyy-mm-dd hh24:mi:ss');

3、执行下面两条SQL,即可将数据恢复到执行update之前,2021-01-28 08:58:08之前的数据。

alter table 表名 enable row movement;

flashback table 表名 to timestamp to_timestamp('2019-07-01 15:40:31', 'yyyy-mm-dd hh24:mi:ss');

update delete  commit;后的都可以使用这个恢复!

原文地址:https://www.cnblogs.com/Williamls/p/14339650.html