oracle闪回查询
时间:2022-03-15 08:32
1.查询删除数据的时间点的数据(也就是闪回至该时间点之前的数据)
SELECT * FROM gt19 AS OF TIMESTAMP TO_TIMESTAMP(‘2017-12-21 18:30:00‘, ‘YYYY-MM-DD HH24:MI:SS‘) WHERE gt12001 = ‘c9309c3427e04c8982cd56a251ff772c‘;
2.然后恢复删除且已提交的数据
flashback table gt19 to timestamp to_timestamp(‘2017-12-31 18:30:00‘,‘yyyy-mm-dd hh24:mi:ss‘)
或者:
INSERT INTO gt19 ( SELECT * FROM gt19 AS OF TIMESTAMP TO_TIMESTAMP(‘2017-12-21 18:30:00‘, ‘YYYY-MM-DD HH24:MI:SS‘) WHERE gt12001 = ‘c9309c3427e04c8982cd56a251ff772c‘ );