oracle 如何恢复误删的表记录数据

--开启行移动功能
ALTER TABLE tablename ENABLE row movement ;

--恢复表数据,时间为删除或修改的时间点
flashback table tablename to timestamp to_timestamp('2016-05-07/17:01:50','yyyy-mm-dd hh24:mi:ss');
--备注:恢复后请关闭行移动功能
ALTER TABLE tablename DISABLE row movement ;
 

 

1、查询表数据如下:

select T.*,SYSDATE from Z_TEST t

      DN                SYSDATE
1 ABCDEFGHIG 2016-5-7 17:19:06

2、删除数据

DELETE FROM Z_TEST;

3、恢复删除的数据

ALTER TABLE z_Test ENABLE ROW Movement;
Flashback TABLE z_Test TO TIMESTAMP To_Timestamp('2016-5-7/17:19:06', 'yyyy-mm-dd hh24:mi:ss');
ALTER TABLE z_Test DISABLE ROW Movement;

 

SELECT COUNT(0)
  FROM Sm_Affix AS OF TIMESTAMP To_Timestamp('2016-08-17/17:30:00', 'yyyy-mm-dd hh24:mi:ss') t
 WHERE EXISTS (SELECT * FROM Sm_Affix_0817002 a WHERE a.Row_Id = t.Row_Id)

 

posted @ 2016-05-07 17:31  Luca-  阅读(1734)  评论(0编辑  收藏  举报