Professional Documents
Culture Documents
COMP1638: Database Management and Administration Lab 8 Flashback Technologies
COMP1638: Database Management and Administration Lab 8 Flashback Technologies
COMP1638: Database Management and Administration Lab 8 Flashback Technologies
Lab 8
Flashback Technologies
Overview
In this lab you will perform data recovery using flashback technology. First you will use Flashback Drop
functionality to recover a table after it’s been accidently dropped and then you will use Flashback Table
functionality to recover from unwanted committed transactions.
4. Now you need to verify that the table books_main has been dropped by querying the data dictionary.
Question 1: What SQL command do you need to execute to check the existence of the table books_main in
the agreen schema using dba_tables data dictionary view? Execute the command in SQL*Plus. Make a
screen-shot of the result and explain.
Notice the system name that was given to the dropped table
7. Recover table books_main using Flashback Drop functionality in SQL*PLus (use the lecture notes to
guide you).
Question 2: What SQL command do you need to execute to recover completely table books_main after it has
been dropped accidently? Explain how this feature is implemented.
8. After the flashback complete, navigate to the list of tables for AGREEN in EM and check the restored table.
9. Now navigate to agreen schema in SQL Developer and check the Recycle Bin again.
Lab 8.2: Recover data in the table with Flashback Table functionality.
1. In SQL*Plus window (still connected as AGREEN /oracle) check the current records:
2. Insert a new record into the books_main table with the following data:
3. Now you are going to simulate a problem: you had to update the title of the book to ‘Facebook for Dummies’
in the last record, but forgot to put ‘where’ condition into your update command and therefore updated all
records and committed that transaction :
update books_main
Question 3: What is the result of the ROLLBACK command? Explain why it didn’t succeed; discuss the database
principles that are implemented here to provide this behaviour.
5. Now you have to recover the table data from that erroneous transaction.
a) In SQL Developer navigate to all tables for agreen and double click on BOOKS_MAIN. Click on tab
Flashback. The results window will show all historic information on operations performed on that table
including the SCN numbers. Your view might be different from the screen-shot below:
b) Find the Update operation that you want to recover and it’s VERSION_STARTSCN
c) In SQL*Plus recover that erroneous transaction with the help of FLASHBACK TABLE command using
the correct SCN
The error tells you that the Flashback cannot be performed, because ROW MOVEMNT has not been
enabled.
Deliverables:
For formative assessment, please answer the following questions:
Question 1: What SQL command do you need to execute to check the existence of the table books_main
in the agreen schema using dba_tables data dictionary view? Make a screen-shot of the result and
explain.
Question 2: What SQL command do you need to execute to recover completely table books_main after it
has been dropped accidently? Explain how this feature is implemented.
Question 3: What is the result of the ROLLBACK command? Explain why it didn’t succeed; discuss the
database principles that are implemented here to provide this behaviour.