当某张表的数据被删除或者更新错误时,如何快速的恢复呢?
可以用到闪回查询,以表为单位查询过去的数据称为闪回查询。前提是删除时间过长就无法查询到那个时间点的数据了。
使用利用select命令的“as of”子句,闪回时间点查询
--查询具体时间的数据
select * from table as of timestamp to_timestamp('2024-04-14 10:02:30','yyyy-mm-dd,hh24:mi:ss')
--查询10分钟前的数据
select * from table as of timestamp (systimestamp - interval '10' minute) where column=1;
查询出数据就能恢复数据啦,当然闪回技术还有不止 “as of”!!