No Flashback required
to be enable in the database just set the parameter value
RECYCLEBIN='TRUE' then we can recover dropped table from the recyclebin
flashback table <dropped_table> to before drop )
SQL> conn /as sysdba
Connected.
SQL> select TABLESPACE_NAME,STATUS from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
TEMP ONLINE
USERS ONLINE
SAMTBS1 ONLINE
6 rows selected.
SQL> conn tom/tom
Connected.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
TABLE1 TABLE
TABLE2 TABLE
TABLE3 TABLE
SQL> select * from table2;
ID
----------
987
SQL> insert into table2 VALUES (675);
1 row created.
SQL> insert into table2 VALUES (698);
1 row created.
SQL> insert into table2 VALUES (695);
1 row created.
SQL> select * from table2;
ID
----------
987
675
698
695
SQL> commit;
Commit complete.
SQL> conn /as sysdba
Connected.
SQL> drop table tom.table2;
Table dropped.
SQL> commit;
Commit complete.
SQL> select * from tom.table2;
select * from tom.table2
*
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> conn /as sysdba
Connected.
SQL> select OBJECT_NAME,ORIGINAL_NAME from user_recyclebin;
no rows selected
SQL> conn tom/tom
Connected.
SQL> select OBJECT_NAME,ORIGINAL_NAME from user_recyclebin;
OBJECT_NAME ORIGINAL_NAME
------------------------------ --------------------------------
BIN$yj4kFALrck/gQKjAAqgojA==$0 TABLE2
SQL> flashback table table2 to before drop;
Flashback complete.
SQL> select * from table2;
ID
----------
987
675
698
695
SQL> select OBJECT_NAME,ORIGINAL_NAME from user_recyclebin;
no rows selected
SQL> conn /as sysdba
Connected.
SQL> select TABLESPACE_NAME,STATUS from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
TEMP ONLINE
USERS ONLINE
SAMTBS1 ONLINE
6 rows selected.
SQL> conn tom/tom
Connected.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
TABLE1 TABLE
TABLE2 TABLE
TABLE3 TABLE
SQL> select * from table2;
ID
----------
987
SQL> insert into table2 VALUES (675);
1 row created.
SQL> insert into table2 VALUES (698);
1 row created.
SQL> insert into table2 VALUES (695);
1 row created.
SQL> select * from table2;
ID
----------
987
675
698
695
SQL> commit;
Commit complete.
SQL> conn /as sysdba
Connected.
SQL> drop table tom.table2;
Table dropped.
SQL> commit;
Commit complete.
SQL> select * from tom.table2;
select * from tom.table2
*
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> conn /as sysdba
Connected.
SQL> select OBJECT_NAME,ORIGINAL_NAME from user_recyclebin;
no rows selected
SQL> conn tom/tom
Connected.
SQL> select OBJECT_NAME,ORIGINAL_NAME from user_recyclebin;
OBJECT_NAME ORIGINAL_NAME
------------------------------ --------------------------------
BIN$yj4kFALrck/gQKjAAqgojA==$0 TABLE2
SQL> flashback table table2 to before drop;
Flashback complete.
SQL> select * from table2;
ID
----------
987
675
698
695
SQL> select OBJECT_NAME,ORIGINAL_NAME from user_recyclebin;
no rows selected
No comments:
Post a Comment