Monday, February 06, 2012

FlashBack Drop in Oracle

When you drop a table from Oracle database the data is not deleted all of a sudden from Database,It goes to recycle bin just like in our windows.So if you have dropped a table by mistake you can actually recover it from recycle bin of database.By default this feature is not enabled.

First thing is to enable the recycle bin

To enable the recycle bin for a session we can use the following command
ALTER SESSION SET RECYCLEBIN=ON

In a similar away recycle bin for the entire database can be enabled by using following command
ALTER SYSTEM SET RECYCLEBIN=ON

Now you can view that dropped table using the following select command

SELECT * FROM RECYCLEBIN where original_name='name of table'

No comments: