Total PageViews

Thursday, August 1, 2019

Recover dropped table using Flashback through Recyclebin in Oracle


Suppose we have table “Dummy_Rec”

Query :- Select * from Dummy_Rec;
O/P:-  Id     |     Name
           --------------------
            1      |     A
            1      |     B
            1      |     C
            2      |     D

Accidently we have dropped the table.

Query :- Drop table Dummy_Rec;

O/P:-     table DUMMY_REC dropped.

               Commit; --------à (Commit command executed)

To Recover the table follow the below commands

Step 1:- Check the Recyclebin for the dropped table

Query:-  SELECT object_name as recycle_name, original_name,Type,DROPTIME type
                   FROM Recyclebin 
                  where  ORIGINAL_NAME='DUMMY_REC';

O/P:- RECYCLE_NAME                                     ORIGINAL_NAME    TYPE          TYPE              
             ------------------------------------------------       -------------------------     ------------    -------------------
             BIN$Y75AaaDYTR6n2bJqfn0Q6g==$0     DUMMY_REC              TABLE       2019-08-01:17:39:17

Command to recover:-

Query:- Flashback table "SCOTT"."BIN$Y75AaaDYTR6n2bJqfn0Q6g==$0"
              to before drop rename  to dummy_rec;
           
O/P:-  table "SCOTT"."BIN$Y75AaaDYTR6n2bJqfn0Q6g==$0" succeeded.

Note:- Here “BIN$Y75AaaDYTR6n2bJqfn0Q6g==$0” is the Recycle_Name.

Now check your database table is recovered with data.

Query :- Select * from Dummy_Rec;
O/P:-  Id     |     Name
           --------------------
            1      |     A
            1      |     B
            1      |     C
            2      |     D


No comments:

Post a Comment