拯救oracle刚被误删的数据
2.误删除所有记录
并且提交更改。
SQL>delete from t1;
9318 rows deleted.
SQL>commit;
Commit complete.
SQL>select count(*) from t1;
?? COUNT(*)
----------
????????? 0
3.获得当前SCN
如果能够确切知道删除之前SCN最好,如果不知道,可以进行闪回查询尝试.
SQL>select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
???????????????? 10671006
SQL>select count(*) from t1 as of scn 10671000;
?? COUNT(*)
----------
????????? 0
SQL>select count(*) from t1 as of scn 10670000;
?? COUNT(*)
----------
?????? 9318
我们看到在SCN=10670000时,数据都在。
4.恢复数据.
SQL>insert into t1 select * from t1 as of scn 10670000;
9318 rows created.
SQL>commit;
Commit complete.
SQL>select count(*) from t1;
?? COUNT(*)
----------
?????? 9318