oracle 闪回查询

ls-syh / 2024-09-25 / 原文

---闪回查询

SQL> select * from emp as of timestamp (systimestamp - interval '2' minute); ---查询emp表2分钟之前的数据

SQL> select * from emp as of timestamp (systimestamp - interval '120' second); ---查询emp表120秒之前的数据

SQL> select * from emp as of timestamp (systimestamp - interval '12' hour); ---查询emp表12小时之前的数据

SQL> select * from emp as of timestamp (systimestamp - interval '12' day); ---查询emp表12天之前的数据

SQL> select * from emp as of timestamp sysdate-2; ---查询emp表2天之前的数据

SQL> select * from table_name as of timestamp to_timestamp('2023-05-22 10:00:00','yyyy-mm-dd hh24:mi:ss'); ---根据时间查询