[bbk5120] 第44集 第四章 Flashback Database 08

Restoring Tables from the Recycle Bin

  • Restore dropped tables and dependent objects.
  • If multiple recyclye bin entries have the same original name:
    • Use qunique,system-generated names to restore a particular version.
    • When using original names,the restored table is last in,first out(LIFO)
  • Rename the original name if that name is currently used.
FLASHBACK TABLE <table_name> TO REFORE DROP [RENAME TO <new_name>];

Recycle Bin:Automatic Space Reclamation

Recycle Bin:Manual Space Reclamation

PURAGE {TABLE <table_name> | INDEX <index_name>}

PURAGE TABLESPACE <ts_name> [USER <user_name>]

PRUAGE [USER_|DBA_] RECYCLEBIN

Bypassing the Recycle Bin

DROP TABLE <table_name> [PURGE];
DROP TABLESPACE <ts_name> [INCLUDING CONTENTS];
DROP USER <user_name> [CASCADE];

Security considerations for the recycle bin:

ALTER SYSTEM SET RECYCLEBIN=OFF SCOPE=SPFILE;

Querying the Recycle Bin

SQL> l
  1  SELECT owner,original_name,object_name,type,ts_name,droptime,related,space
  2  FROM dba_recyclebin
  3* WHERE can_undrop = 'YES'
SQL> /

OWNER      ORIGINAL_NAME             OBJECT_NAME                    TYPE                      TS_NAME                        DROPTIME               RELATED      SPACE
---------- ------------------------- ------------------------------ ------------------------- ------------------------------ ------------------- ---------- ----------
SCOTT      EMP1                      BIN$3Oa1+S5bGnvgQAAAAAA3aQ==$0 TABLE                     USERS                          2013-05-17:16:24:25      80370          8
ARCER      T                         BIN$pfwr1Jtji5zgQPrc4kAI7Q==$0 TABLE                     USERS                          2011-06-18:19:55:16      74574          8
ARCER      SYS_FBA_HIST_80587        BIN$3RJoV7r6XA7gQAAAAABh/A==$0 TABLE                                                    2013-05-19:20:32:21      80589
U3         COMPOSITE1                BIN$3EgRsliwFWPgQAAAAABnMA==$0 TABLE                                                    2013-05-09:19:08:24      79684
SQL> SELECT original_name,object_name,ts_name,droptime
  2  FROM user_recyclebin WHERE can_undrop = 'YES';

no rows selected
SQL> SHOW RECYCLEBIN

Quiz

When you flash back a dropped table,the recovered indexes,triggers,and constraints keep their recycle bin names.

1、True

2、False

原文地址:https://www.cnblogs.com/arcer/p/3101199.html