昨天晚上一不小心把某表删除了,提交了。捉急啊,没想到oracle数据库竟然有直接恢复的功能。
SELECT * FROM t_ba_repay_plan AS OF TIMESTAMP
TO_TIMESTAMP('2017-04-06 21:00:10.345','yyyy-MM-dd HH24:MI:ss.ff') ---2200条
SELECT plan_id FROM t_ba_repay_plan AS OF TIMESTAMP
TO_TIMESTAMP('2017-04-06 21:20:10.345','yyyy-MM-dd HH24:MI:ss.ff') ---只剩下200条,
那么如何恢复删除的2000条数据呢,一个sql搞定。太方便了。记录一下,以免以后忘记
insert into t_ba_repay_plan SELECT * FROM t_ba_repay_plan AS OF TIMESTAMP TO_TIMESTAMP('2017-04-06 21:00:10.345','yyyy-MM-dd HH24:MI:ss.ff') where plan_id not in( SELECT plan_id FROM t_ba_repay_plan AS OF TIMESTAMP TO_TIMESTAMP('2017-04-06 21:20:10.345','yyyy-MM-dd HH24:MI:ss.ff'))
原文链接:https://www.f2er.com/oracle/209748.html