oracle恢复某段时间之前的数据

1、通过以下sql就可以查询出多少分钟之前的数据

select * from  test  as of timestamp sysdate - 10 / 1440 --test为需要恢复数据的表名 ,10表示十分钟,30则表示30分钟之前的,1440表示一天有1440分钟。

2、如果精确到某段时间点,则可以用以下sql查询

       SELECT * FROM test AS OF TIMESTAMP to_date('2020-05-14 11:09:21','YYYY-MM-DD HH24:MI:SS');

后边都可以接 where 条件进行筛选

如:SELECT * FROM test AS OF TIMESTAMP to_date('2020-05-14 11:09:21','YYYY-MM-DD HH24:MI:SS') where test.id<100';

然后获取的数据可以通过 Insert into select等语句恢复

insert  into test  select * from test of timestamp sysdate-10/1440;


 

猜你喜欢

转载自blog.csdn.net/jungeCSND/article/details/106115023
今日推荐