Oracle数据库回滚、删除数据恢复、回滚数据库数据到某个具体的时间点

Oracle数据库回滚、删除数据恢复、回滚数据库数据到某个具体的时间点

Oracle 回滚数据库到某个具体的时间点,需要确保中间没有人修改数据,否则中间修改的数据会丢失

alter table xxx enable row movement;

flashback table xxx to timestamp to_timestamp('2023-02-21 17:00:00','yyyy-mm-dd HH24:MI:SS');

主要用到了Oracl数据库的行迁移,然后闪回到某个时间点:

alter table 表名 enable row movement;

flashback table 表名 to timestamp to_timestamp('2023-02-21 17:00:00','yyyy-mm-dd HH24:MI:SS’);

如果数据库某条记录不小心删除,可以使用as of timestamp时间戳查询删除之前某个时间点的数据,找到对应的记录,直接拷贝出来恢复即可:

固定的格式,替换一下表名、时间点和查询条件即可。

select temp.*

from (select * from xxx as of timestamp to_timestamp('2023-02-21 17:20', 'yyyy-MM-dd hh24:mi')) temp

where xxxx;

相关推荐