Flashback Queries

Flashback Query allows users to see the view of past data, If in case some data or table is being deleted by the user, then the flashback query provides us an opportunity to view that data again and perform manipulations over it.

In flashback queries we have an concept of flash area, in flash area we store the deleted data which can be viewed if needed in future.

To use the feature of flashback query, our server must be configured according to automatic undo management.If our system supports the traditional approach of rollback then we can not perform flashback query on such systems.

We can enable the flashback query using the package DBMS_FLASHBACK. This package enables us to view the data in past by specifying the System change number or the exact time in the past.

How to use DBMS_FLASHBACK :



EXECUTE Dbms_Flashback.Enable_At_System_Change_Number(647392649);
EXECUTE Dbms_Flashback.Enable_At_Time('19-APR-2020 11:00:00); 

Example of Flashback Query :
If we want to view a past data which is being deleted by mistake.The data consists of students table and it is being deleted at 11:05 AM on 19-APR-2020.To access the data we can use flashback query either by giving exact time or by mentioning the system change number.

Limitations Flashback Query :

  1. Flashback query only works on those systems which supports automatic undo management.
  2. Systems having traditional approach of rollback does not supports flashback query.
  3. We can not use DDL (Data Definition Language) or DML (Data Manipulation Language) while performing flashback query.
  4. Flashback query does not reverse the DDL(Data Definition Language) commands.
  5. Flashback query can perform manipulations in DDL(Data Definition Language) commands.
  6. We can not apply flashback queries on functions, Packages, Procedures and triggers.

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


1


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.