Related Data Dictionary Objects
· recyclebin$
· dba_recyclebin
· recyclebin
· user_recyclebin
user_recyclebin and dba_recyclebin are use for recovery using flashback
SQL> SELECT name, value
FROM v$parameter
WHERE name LIKE 'recyc%';
NAME VALUE
----------------------
recyclebin on
How to Use Recycle Bin in Oracle 10g
Starting and stopping the recyclebin
Syntax:
ALTER SYSTEM SET recyclebin=<OFF | ON> SCOPE=<BOTH | MEMORY | SPFILE>;
By default recyclebin is set to on
SQL> select OBJECT_NAME, ORIGINAL_NAME, TYPE from dba_recyclebin;
no rows selectedSQL> drop table scott.emp;
Table dropped.
SQL> select OBJECT_NAME, ORIGINAL_NAME, TYPE from dba_recyclebin;
OBJECT_NAME ORIGINAL_NAME TYPE
-----------------------------------------------------------------
BIN$iSsOuMCxThKB65n/ep2Y5g==$0 PK_EMP INDEX
BIN$JsuRtykaSpOd8XLplx1/vA==$0 EMP TABLE
To recover the emp table issue the following command
Syntax:
FLASHBACK TABLE <table_name> TO BEFORE DROP {RENAME TO <new_table_name>};
SQL> flashback table scott.emp to before drop;
Flashback complete.
Now emp table is restored from recyclebin.
You can also rename the table during the time of restore
SQL> flashback table scott.emp to before drop
RENAME TO scott.emp2;
To clear the recycle bin issue the following command
Syntax:
PURGE TABLE <recycle_bin_name>;
SQL> PURGE TABLE scott.emp;
Table purged.
Remove Recycle Bin Objects by Tablespace and User
Syntax:
PURGE TABLESPACE <tablespace_name>
USER <schema_name>;
SQL Code:
PURGE TABLESPACE users USER scott;
Clear full recycilebin
Syntax:
PURGE RECYCLEBIN
Empty Everything in All Recycle Bins
SQL Code:
PURGE dba_recyclebin;
No comments:
Post a Comment