How do I recover an Oracle database table with recyclebin?
One feature of Oracle 10g is recyclebin, which allows
you to recover dropped tables. With recyclebin, any
tables you drop do not actually get deleted. Instead, Oracle renames
the table and its associated objects to a system-generated name that
begins with BIN$.
For example, consider this simple table:
SQL> create table testing (col varchar2(10), row_chng_dt date); Table created. SQL> insert into testing values ('Version1', sysdate); 1 row created. SQL> select * from testing ; COL ROW_CHNG ---------- -------- Version1 16:10:03Dropping this table will place it in recyclebin:
Dropping this table caused it to be renamed. The table data is still there and you can query it as you would a normal table:
SQL> select * from "BIN$HGnc55/7rRPgQPeM/qQoRw==$0" ; COL ROW_CHNG ---------- -------- Version1 16:10:03Because the table data is still there, it's very easy to "undrop"
the table; use the FLASHBACK TABLE... TO BEFORE DROP
command. This simply renames the BIN$... table to its
original name:
Note: After a table has been dropped, it has only
been renamed. It is still part of your tablespace, and this space
counts against your user tablespace quota. The space will not be
reclaimed until you restore the table with the flashback
command or use purge to clear the table out of
recyclebin:
Oracle will leave objects in recyclebin until the
tablespace runs out of space, or until you reach your user quota on
the tablespace. At that point, Oracle purges the objects one at a
time, starting with the ones dropped the longest time ago, until there
is enough space for the current operation.
Last modified on February 02, 2009.







