Difference between revisions of "Flashback Table Drop"

From Ittichai Chammavanijakul's Wiki
Jump to navigation Jump to search
(Created page with "* Dropped table is renamed and placed in the Recyclebin. <pre> SQL> drop table TESTTABLE; Table dropped. SQL> select * from tab; TNAME TABTYPE CLUSTERI...")
(No difference)

Revision as of 09:10, 11 March 2011

  • Dropped table is renamed and placed in the Recyclebin.
SQL> drop table TESTTABLE;
Table dropped.

SQL> select * from tab;
TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
BIN$04LhcpndanfgMAAAAAANPw==$0 TABLE
  • To view the contents in the Recyclebin.
SQL> show recyclebin

ORIGINAL NAME    RECYCLEBIN NAME                OBJECT TYPE  DROP TIME
---------------- ------------------------------ ------------ ------------------
TESTTABLE        BIN$04LhcpndanfgMAAAAAANPw==$0 TABLE        2004-02-16:21:13:31
  • Restore the table using Flashback table. The table with the original name will be restored.
SQL> FLASHBACK TABLE TESTTABLE TO BEFORE DROP;
FLASHBACK COMPLETE.
  • Optionally, if name change is needed, for example, there is an existing table name already, the option RENAME TO <TABLENAME> can be used.
SQL> FLASHBACK TABLE TESTTABLE TO BEFORE DROP RENAME TO TESTTABLE1;
FLASHBACK COMPLETE.

SQL> SELECT * FROM TAB;
TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
TESTTABLE                      TABLE
  • To free up Recyclebin
SQL> PURGE RECYCLEBIN;
  • To permanently drop table
SQL> DROP TABLE TESTTABLE PURGE;