Flashback

来源:互联网 发布:卖家对淘宝诈骗提醒 编辑:程序博客网 时间:2024/06/11 19:53


test@ORCL>exec :scn := dbms_flashback.get_system_change_number

PL/SQL procedure successfully completed.

test@ORCL>print scn

       SCN
----------
    682621

test@ORCL>select count(*) from emp;

  COUNT(*)
----------
 14

test@ORCL>delete from emp;

14 rows deleted.

 

test@ORCL>select count(*) from emp;

  COUNT(*)
----------
  0

test@ORCL>commit;

Commit complete.

 


test@ORCL>select *
  2  from (select count(*) from emp),
  3  (select count(*) from emp as of scn:scn)
  4  /

  COUNT(*)   COUNT(*)
---------- ----------
  0    14


test@ORCL>flashback table emp to scn:scn
  2  ;

Flashback complete.

 

 

PL/SQL procedure successfully completed.

 

test@ORCL>print scn

       SCN
----------
    682621

test@ORCL>select count(*) from t;

  COUNT(*)
----------
  0

test@ORCL>drop table t;

Table dropped.

 

test@ORCL>flashback table t to scn:scn
  2  ;
flashback table t to scn:scn
                *
ERROR at line 1:
ORA-00942: table or view does not exist

 

这样无法恢复被删除的表

 

 

 

There is a table tb in database, use it to perform dropping table and flashbacking operation;

 

There is a index tb_index on table tb;

 

 Drop table tb ;

 

Table tb is missing from system table tab;

 

 The table tb deleted is in recyclebin.

 

The index on table tb is deleted also;

 

 Use flashback command to restore the table had been deleted.

 

 

 

 

 参考:http://www.sudu.cn/info/article/articleInfo.php?aId=196883

原创粉丝点击