Recovering dropped table is easy in Oracle, provided that the table was not dropped with PURGE option. In case the table is dropped and space occupied by the table is released and the table does not get moved into the recycle bin. But if table is dropped without PURGE option, Oracle has this very neat feature - Recycle bin, similar to the recycle bin in Windows. There are two recyle bin views in Oracle: USER_RECYCLEBIN and DBA_RECYCLEBIN, Synonym RECYCLEBIN points to your USER_RECYCLEBIN.
The recycle bin can be turned on and off with RECYCLEBIN initialization parameter. When table is dropped, it get rename to system-generated name preceeded with BIN and stored in recycle bin. The important thing to know is that after table has been dropped, it's only been renamed, the table segmants are still in the tablespace, unchanged. the space occupied by the table will not be reclaimed until the table has been purged from the recycle bin.
While in the recycle bin, the table can even be queried using the newly generated name that starts qwith BIN$.
The table can easily be recovered from the recycle bin using flashback drop, which will rename the table to its original name.
You can check flashback mode by running
The recycle bin can be turned on and off with RECYCLEBIN initialization parameter. When table is dropped, it get rename to system-generated name preceeded with BIN and stored in recycle bin. The important thing to know is that after table has been dropped, it's only been renamed, the table segmants are still in the tablespace, unchanged. the space occupied by the table will not be reclaimed until the table has been purged from the recycle bin.
While in the recycle bin, the table can even be queried using the newly generated name that starts qwith BIN$.
The table can easily be recovered from the recycle bin using flashback drop, which will rename the table to its original name.
You can check flashback mode by running
SELECT FLASHBACK_ON FROM V$DATABASE;First check the parameter Recyclebin is set to true. Recycle bin is a data dictionary table that contains information about dropped objects. Dropped tables and any associated objects such as indexes, constraints, nested tables, and the likes are not removed and still occupy space. They continue to count against user space quotas, until specifically purged from the recycle bin or the unlikely situation where they must be purged by the database because of tablespace space constraints.
SHOW PARAMETER RECYCLEBIN;if recyclebin is set to off, perform the following steps:
- run
ALTER SYSTEM SET RECYCLEBIN=ON SCOPE=SPFILE;
- verify that recyclebin parameter is now set to ON
- shutdown the database
SHUTDOWN IMMEDIATE
- Restart the database
STARTUP
SELECT * FROM RECYCLEBIN;and see if your table is in there. If it is, use the following quesry to restore it:
FLASHBACK TABLEThen check if the table is back:TO BEFORE DROP;
SELECT * FROM USER_TABLES WHERE TABLE_NAME=;
Bullshit ...when recyclebin is off as mentioned in main heading ...
ReplyDeletenor correct
ReplyDelete