Database Reference
In-Depth Information
7. Query the employees table again to verify that the change was eliminated because of
the Flashback Table operation:
SQL> select employee_id, salary
from employees
where employee_id = 110;
EMPLOYEE_ID SALARY
----------- ----------
110 8200
As the example shows, the table has been recovered to its previous state, as it existed
back at SCN 623411. Also, if any dependent objects such as indexes existed on the table,
they would have also been recovered to maintain consistency.
If a table contains triggers, however, there are some special rules that apply when a
Flashback Table operation is performed. All triggers are disabled during a Flashback Table
operation. By default, they will remain disabled after the operation is complete, regardless
of whether the trigger was previously enabled or not.
If a table has one or more enabled triggers and you want them to remain enabled after
the Flashback Table operation is complete, you can add the ENABLE TRIGGERS clause to the
statement, as shown here:
SQL> flashback table employees
to scn 623411
enable triggers;
When you specify the ENABLE TRIGGERS option, all triggers that were previously enabled
will be reenabled after the operation is complete. Note that the trigger did not remain
enabled during the Flashback Table operation. As stated before, all triggers are disabled
during the operation (they will not fire in conjunction with the recovery operation). They
are then reenabled only after the operation is complete.
As you can see, the Flashback Table operation is a valuable recovery method. Now
when a user updates a table using an incorrect WHERE clause, you can simply undo the
change using Flashback Table. They could even do it themselves. And, best of all, the
availability of the database is not impacted by the operation. Please keep in mind that
more complex flashback operations may be required, depending on the number of objects
and relations impacted.
In Exercise 8.3, you'll practice using the Flashback Table feature; continue using the
table created in Exercise 8.2.
Search WWH ::




Custom Search