时间:2021-07-01 10:21:17 帮助过:11人阅读
然后执行第二行时,执行失败,原因是闪回操作在一个事务中,之前被删除数据间的父子关系必须是先有父记录,再恢复子记录,因此至少需要两次闪回。此时必须知道之前删除数据的准确时间。此处利用Oracle提供的系统视图——v$sql 或 v$sqlarea,查询删除语句的执行时间:
select * from v$sqlarea t where t.SQL_TEXT like ‘DELETE FROM TABLENAME T WHERE ID%‘ order by t.LAST_ACTIVE_TIME desc;--like的内容区分大小写
查询到结果[复制出 SQL_TEXT 列和 LAST_ACTIVE_TIME 列]:
DELETE FROM SECURITY_MODULE T WHERE ID = ‘402899955f28120f015f284e2a6b01b2‘ 2017-10-25 9:53:39
DELETE FROM SECURITY_MODULE T WHERE ID = ‘402899955f28120f015f285d55d701b7‘ 2017-10-25 9:53:35
DELETE FROM SECURITY_MODULE T WHERE ID = ‘402899955f28120f015f2853c88701b3‘ 2017-10-25 9:53:35
DELETE FROM SECURITY_MODULE T WHERE ID = ‘402899955f28120f015f285c983401b4‘ 2017-10-25 9:53:35
DELETE FROM SECURITY_MODULE T WHERE ID = ‘402899955f28120f015f285d9c6501b8‘ 2017-10-25 9:53:35
DELETE FROM SECURITY_MODULE T WHERE ID = ‘402899955f28120f015f285d009301b6‘ 2017-10-25 9:53:35
DELETE FROM SECURITY_MODULE T WHERE ID = ‘402899955f28120f015f285ccc1501b5‘ 2017-10-25 9:53:35
DELETE FROM SECURITY_MODULE T WHERE ID = ‘402899955f28120f015f2838d52d01ad‘ 2017-10-25 9:53:34
结果刚好是之前的删除语句,根据LAST_ACTIVE_TIME,最后执行的是第一条,各数据的先后关系确定。接着做闪回操作,设置闪回时间为:2017-10-25 9:53:39,
第二次设置为:2017-10-25 9:53:34,数据顺利恢复。
恢复Oracle误删数据一点小记
标签:rom esc span 误删 区分 lang bsp 因此 今天