In 11g when a table is dropped ..we can retriew back the following table using FLASHBACK query.
Restore the table with the following command:
FLASHBACK TABLE <TABLE_NAME> TO BEFORE DROP;
For Example:-
SQL> create table oracle (name varchar2(20));
Table created.
SQL> insert into oracle values('Satya');
1 row created.
SQL> select * from oracle;
NAME
--------------------
Satya
SQL> drop table oracle;
Table dropped.
SQL> select * from oracle;
select * from oracle
*
ERROR at line 1:
ORA-00942: table or view does not exist
Note: Now the above table "oracle is dropped .
Table does not exists...we can see the table in recyclebin by following sql command:-
SQL> SELECT OBJECT_NAME, ORIGINAL_NAME, TYPE FROM RECYCLEBIN;
OBJECT_NAME ORIGINAL_NAME TYPE
------------------------------ -------------------------------- -------------------------
BIN$pyfjVjvV3OHgQFWMdMhiQg==$0 ORACLE TABLE
BIN$pyfjVjvU3OHgQFWMdMhiQg==$0 SS TABLE
BIN$pxeahCChqOTgQFWMdMgheQ==$0 SS TABLE
BIN$prBPuubG8P7gQFWMdMgPLA==$0 SR_12345_ TABLE
BIN$piofHuXuVWDgQFWMdMgC+A==$0 BKP_INVALID_AKI TABLE
BIN$piakkjwShjXgQFWMdMgm0A==$0 INVALIDS_20JUN2011 TABLE
BIN$piX8k2KQfLzgQFWMdMheXA==$0 SR_12345_ TABLE
BIN$paZUgalvhhXgQFWMdMhzlQ==$0 SR_1234_ TABLE
BIN$pZDIBAqsLYDgQFWMdMgwow==$0 SR_1234_ TABLE
BIN$pZAjrDASg8bgQFWMdMgIbQ==$0 SR_1234_ TABLE
BIN$pSCWykSWosTgQFWMdMgxXw==$0 BKP_INVALID_AKI TABLE
BIN$pKfzjeIaO6zgQFWMdMgLVA==$0 SR_123_ TABLE
12 rows selected.
SQL>
Now we can get the table from Recyclebin by using FLASHBACK query:
SQL> FLASHBACK TABLE oracle to before drop;
Flashback complete.
SQL>
Now check the table "oracle".it will exits:-
SQL> select * from oracle;
NAME
--------------------
Satya
Restore the table with the following command:
FLASHBACK TABLE <TABLE_NAME> TO BEFORE DROP;
For Example:-
SQL> create table oracle (name varchar2(20));
Table created.
SQL> insert into oracle values('Satya');
1 row created.
SQL> select * from oracle;
NAME
--------------------
Satya
SQL> drop table oracle;
Table dropped.
SQL> select * from oracle;
select * from oracle
*
ERROR at line 1:
ORA-00942: table or view does not exist
Note: Now the above table "oracle is dropped .
Table does not exists...we can see the table in recyclebin by following sql command:-
SQL> SELECT OBJECT_NAME, ORIGINAL_NAME, TYPE FROM RECYCLEBIN;
OBJECT_NAME ORIGINAL_NAME TYPE
------------------------------ -------------------------------- -------------------------
BIN$pyfjVjvV3OHgQFWMdMhiQg==$0 ORACLE TABLE
BIN$pyfjVjvU3OHgQFWMdMhiQg==$0 SS TABLE
BIN$pxeahCChqOTgQFWMdMgheQ==$0 SS TABLE
BIN$prBPuubG8P7gQFWMdMgPLA==$0 SR_12345_ TABLE
BIN$piofHuXuVWDgQFWMdMgC+A==$0 BKP_INVALID_AKI TABLE
BIN$piakkjwShjXgQFWMdMgm0A==$0 INVALIDS_20JUN2011 TABLE
BIN$piX8k2KQfLzgQFWMdMheXA==$0 SR_12345_ TABLE
BIN$paZUgalvhhXgQFWMdMhzlQ==$0 SR_1234_ TABLE
BIN$pZDIBAqsLYDgQFWMdMgwow==$0 SR_1234_ TABLE
BIN$pZAjrDASg8bgQFWMdMgIbQ==$0 SR_1234_ TABLE
BIN$pSCWykSWosTgQFWMdMgxXw==$0 BKP_INVALID_AKI TABLE
BIN$pKfzjeIaO6zgQFWMdMgLVA==$0 SR_123_ TABLE
12 rows selected.
SQL>
Now we can get the table from Recyclebin by using FLASHBACK query:
SQL> FLASHBACK TABLE oracle to before drop;
Flashback complete.
SQL>
Now check the table "oracle".it will exits:-
SQL> select * from oracle;
NAME
--------------------
Satya
No comments:
Post a Comment