oracle误操作(删除或者修改)数据恢复

oracle提供了一种闪回的方法,可以将某个时间的数据给还原回来

方法如下:

方法一:

1.select * from table as of timestamp to_timestamp('2016-10-16 16:24:00', 'yyyy-mm-dd hh24:mi:ss');

说明:table是误操作,需要闪回的表,2016-10-16 16:24:00这个时间点是误操作的那个时间点,是个大概的时间,不用精确,在这个时间之前就是之前正确的数据,之后就是误操作后的数据

 

2.alter table table enable row movement;

闪回操作前启用行移动功能

说明:table是误操作,需要闪回的表

 

3.flashback table account to timestamp TO_TIMESTAMP('20160422 15:10:00','YYYYMMDD HH24:MI:SS');

说明:table是误操作,需要闪回的表,20160422 15:10:00时间点与步骤1的时间点相同。

 

方法二:

1.select * from table as of timestamp to_timestamp('2016-10-16 16:24:00', 'yyyy-mm-dd hh24:mi:ss');

 说明:table是误操作,需要闪回的表,2016-10-16 16:24:00这个时间点是误操作的那个时间点,是个大概的时间,不用精确,在这个时间之前就是之前正确的数据,之后就是误操作后的数据
 
2.create table test_171205_tmp as select * from test_171205 as of timestamp to_timestamp('2017-12-05 21:20:11','yyyy-mm-dd hh24:mi:ss');
--创建一个临时表,用来保存2017-12-05 21:20:10分之前的数据
 
3.drop table test_171205;
--删除原来的表
 
4.alter table test_171205_tmp rename to test_171205;
--更改临时表的表名
 
posted @ 2020-01-16 16:32  Coco`  阅读(1162)  评论(0)    收藏  举报