flashback技術之---flashback drop

lsq_008發表於2012-07-29
簡而言之,flashback drop就是將已經被drop的表從recycebin中恢復回來,表被drop後,實際上只是改了個名,並沒有釋放空間。

1. 啟用和禁用recyclebin:
ALTER SESSION SET recyclebin = OFF;

ALTER SYSTEM SET recyclebin = OFF;

ALTER SESSION SET recyclebin = ON;

ALTER SYSTEM SET recyclebin = ON;

2.使用recyclebin進行flashback drop

SQL> create table test tablespace users as select * from dba_objects;

Table created.

SQL> select object_name,original_name,operation,type,ts_name,createtime,droptime from recyclebin;

no rows selected

SQL> drop table test;

Table dropped.

SQL> select object_name,original_name,operation,type,ts_name,createtime,droptime from recyclebin;

OBJECT_NAME                    ORIGINAL_N OPERATION TYPE       TS_NAME    CREATETIME          DROPTIME
------------------------------ ---------- --------- ---------- ---------- ------------------- -------------------
BIN$xRCsD3sxEqbgQAB/AQAqpw==$0 TEST       DROP      TABLE      USERS      2012-07-18:09:42:38 2012-07-18:09:42:48

SQL> FLASHBACK TABLE test TO BEFORE DROP  RENAME TO TEST_BAK;

Flashback complete.

SQL> select count(*) from test_bak;

  COUNT(*)
----------
     44940

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10972173/viewspace-738208/,如需轉載,請註明出處,否則將追究法律責任。

相關文章