Search This Blog

Friday, April 10, 2015

RECYCLEBIN Concept

SQL> SELECT * FROM tab;
DEPT
EMP
BONUS
SALGRADE

SQL> DROP TABLE emp;
Table dropped.

SQL> SELECT * FROM tab;

TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
BIN$rPTa2P2JR0iX9PYUu38Wsw==$0 TABLE
DEPT                                TABLE
BONUS                            TABLE
SALGRADE                    TABLE

SQL> SHOW RECYCLEBIN
ORIGINAL NAME    RECYCLEBIN NAME                OBJECT TYPE  DROP TIME
---------------- ------------------------------ ------------ -------------------
EMP              BIN$rPTa2P2JR0iX9PYUu38Wsw==$0 TABLE        2015-04-10:23:54:38

SQL> FLASHBACK TABLE EMP TO BEFORE DROP;
Flashback complete.

SQL> SELECT * FROM TAB;

TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
EMP                            TABLE
DEPT                          TABLE
BONUS                       TABLE
SALGRADE               TABLE

The table is restored successfully.  In this concept the table doesn't go permanently from the database. It stays there in recyclebin. It still takes space.  If we want to get back that space and remove the table permanently from recyclebin do the following:

SQL> PURGE RECYCLEBIN;

If you don't want to send the table to recyclebin and delete it permanently then use the below command:

SQL> DROP TABLE EMP PURGE;

3 comments:

  1. Thanks..
    Sir could you please send other realtime scenarios in vickey3162@gmail.com mail id..

    Thanks,
    Devdatta

    ReplyDelete