Saturday, February 6, 2010

Flashback Table in 10g

Reinstating an accidentally dropped table is effortless using the Flashback Table feature in Oracle Database 10g

Here's a scenario that happens more often than it should: a user drops a very important table--accidentally, of course--and it needs to be revived as soon as possible. (In some cases, this unfortunate user may even have been you, the DBA!)

Oracle9i Database introduced the concept of a Flashback Query option to retrieve data from a point in time in the past, but it can't flash back DDL operations such as dropping a table. The only recourse is to use tablespace point-in-time recovery in a different database and then recreate the table in the current database using export/import or some other method. This procedure demands significant DBA effort as well as precious time, not to mention the use of a different database for cloning.

Enter the Flashback Table feature in Oracle Database 10g, which makes the revival of a dropped table as easy as the execution of a few statements. Let's see how this feature works.

See this,
SQL> drop table test;
We can see that particular table in recyclebin

SQL> show recyclebin;
We can recover that table simply by Flashback command:
SQL> FLASHBACK TABLE RECYCLETEST TO BEFORE DROP;
After that check the Table by
SQL>select * from tab;
We can see that table came back

Cheers!

No comments:

Post a Comment