Using Flashback to recover lost data


Data lost and no time to restore your database

It shouldn't happen very often but even the best developer accidentally removes some data.

Oracle has a feature called Flashback. This technology allows you to run a query from the past but usually not very far into the past. How far it goes depends on the amount of undo data you have.


Recipe #1 - Get Data from the Past using Flashback

We're assuming that you deleted some data in the table EMP which you'd like to get back. The following query will go back one hour and show you the data of that time:

SELECT * FROM emp AS OF TIMESTAMP sysdate-1/24

Flashback does a lot more, it can also recover dropped tables and much more, but the query above is what you should always keep in mind! We'll look into more details in a different recipe!


Please sign-in to post a comment