 |
|
Oracle
Flashback Technology Enhancements
Oracle Tips by Burleson Consulting |
This
is an excerpt from "Oracle 10g New Features for Administrators" by
Ahmed Baraka.
Using the Flashback Technology
You can use the flashback technology at the
database, table, and transaction levels:
• Flashback database enables you to take the
entire database to a past point in time (using flashback logs).
• Flashback drop lets you retrieve
accidentally dropped tables and indexes (using the recycle bin).
• Flashback table lets you recover a table to
a time in the past (using undo data).
• Flashback query lets you query and restore
data rows to a point in time (using undo data).
General Flashback Technology - Guaranteed Undo
Retention
The initialization parameter UNDO_RETENTION enables
you to specify the length of time Oracle must retain undo
information in the undo segments.
Default value: 900 (in seconds)
Modifiable:
ALTER SYSTEM
Range:
0 to 232 – 1
By default, Oracle doesn’t guarantee undo retention.
Methods to specify Undo Guarantee:
o By using the RETENTION GUARANTEE clause when you
create an undo tablespace:
CREATE UNDO
TABLESPACE test1
DATAFILE 'c:\oracle\oradata\undotbs_01.dbf'
SIZE 100M AUTOEXTEND ON
RETENTION GUARANTEE
o You can also use the ALTER TABLESPACE command:
ALTER TABLESPACE
test1 RETENTION GUARANTEE
o You can specify undo guarantee for the undo
tablespace when you create the database.
Note: You can use the RETENTION NOGUARANTEE
clause to turn off the guaranteed retention of undo information.
Note: The amount of time for which undo is
retained for the Oracle Database for the current undo tablespace can
be obtained by querying the TUNED_UNDORETENTION column of the
V$UNDOSTAT dynamic performance view.
Note: Use Oracle’s Undo Advisor to get
approximate undo parameter values as well as suggestions regarding
the sizing of your undo tablespace to successfully support flashback
for a specified time.
Time Mapping Granularity
• Oracle gives you a choice between using either
clock time or the system change number (SCN) to specify exactly what
time in the past you want to go back to.
• The SCN_TO_TIMESTAMP SQL function lets you convert
an SCN to a calendar time (TIMESTAMP) value. There is a mapping
granularity of three seconds.
SELECT current_scn,
SCN_TO_TIMESTAMP(current_scn) FROM v$database
• The TIMESTAMP_TO_SCN function converts a timestamp
to its corresponding SCN.
 |
If you like Oracle tuning, see the
book "Oracle
Tuning: The Definitive Reference", with 950 pages of tuning
tips and scripts.
You can buy it direct from the publisher for 30%-off and get
instant access to the code depot of Oracle tuning scripts. |