Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
NOT
oracle as SYS (by default system tablespace) create a table , drop it , & then try
to flashback it , it will fail. Flashback works on the
NON - SYSTEM
tablespace.
Flashback database uses the Flashback Logs and is controlled by the Flashback
Retention target and default value for flashback retention time is 1400 mins.
SQL> show parameter db_flashback_retention_target ;
DB_FLASHBACK_RETENTION_TARGET is to keep how long oracle would
keep the flashback logs in the flash recovery area (FRA) i.e. ( the period of
time which we want to retain flashback logs). Flashback features are
primarily for data recovery and typically used for DATABASE ADMINS.
Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu
FLASHBACK LEVELS
FLASHBACK LEVELS
ROW LEVEL
TABLE LEVEL
Flashback Technology gives following different ways to track and fix data
corruption.
Flashback database
Flashback drop
Flashback table
Flashback query
Flashback Version query
Flashback Transaction query
Two flashback technologies that do NOT use the undo data, but using
flashback logs and recyclebin. Flashback database & Flashback drop.
Flashback database uses the flashback logs.
Flashback drop uses the recycle bin.
APPLICATION DEVELOPMENT features are ,
We can use a flashback AS OF query to get back the deleted rows. Using
AS OF clause for recovering data to a certain point in time. Flashback queries
EXAMPLE 01 :
SCN number can be obtained before the transaction is initiated by using
As we can query from a table as it was existed in the past. This feature does
not need to set up FLASHBACK area. Recovered deleted data.
Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu
specific time interval (whether the rows were inserted, deleted, or updated)
between two SCNs or time stamps. Even a row was deleted and reinserted ,
all changes are available with this feature and this feature (FVQ) does NOT
need any special setup in the database and based on UNDO tablespace.
Oracle Flashback Version Query is using the VERSIONS BETWEEN clause of
the SELECT statement. The versions of a specific row to be tracked at a
particular time period using the versions between clause. It takes 2 forms as
VERSIONS BETWEEN SCN - [ lower bound ] - [ upper bound ].
VERSIONS BETWEEN TIMESTAMP - [ lower bound ] - [ upper bound ] ;
HH24:MI:SS')
The lower and upper boundaries can either be specific timestamps/SCNs. One
restriction with using specific timestamps or SCNs is that they must be within
the boundaries of the undo_retention parameter. Because The age of the data
available is determined by the undo_retention parameter.
Attempting to flashback undo_retention will result as ORA-30052
- invalid lower limit snapshot expression.
POINTS TO NOTE
PSUEDO COLUMN
DESCRIPTION
VERSIONS_XID
VERSIONS_OPERATION
VERSIONS_STARTSCN
VERSIONS_STARTTIME
VERSIONS_ENDSCN
VERSIONS_ENDTIME
FVQ (SCN).txt
FVQ (TMSTMP).txt
FVQ _TMSTMP1.txt
The Flashback Transaction Query is used to view the changes made to the
database at the transaction level. Oracle provides the data dictionary view
FLASHBACK_TRANSACTION_QUERY This feature (FTQ) queries this view , a
user can determine what changes were made by a specific transaction (or)
what changes were made during a specific time.
Using this method to we can get The UNDO SQL and no need to use LOG
MINER. To get undo sql statement, we need to know Transaction ID (XID)
value, i.e. The VERSIONS_XID column values from a flashback version query
can be used to query the flashback_transaction_query view.
.
FTQ.txt
POINTS TO NOTE
Flashback table related features are Flashback table & Flashback drop.
Oracle Provides Flashback Table feature the DBA having the ability to
simply revert a table to previous point in time i.e. (Recover a table or set of
tables to a specified point in time (past)). To flash back a table, user should
need to an earlier SCN or TIMESTAMP.
Flashback table uses information in the undo tablespace to restore the table.
We can only flash back tables up to the retention time (undo_retention).
Flashback oracle database cannot restore a table to an earlier state across any
DDL operations that change the structure of the table.
POINTS TO NOTE :
Row movement must be enabled on the table, which indicates that rowids will
change after the flashback occurs. This restriction exists because if rowids
before the flashback were stored by the application, then there is no guarantee
that the rowids will correspond to the same rows after the flashback. If your
application depends on rowids, then we cannot use Flashback Table.
FLASHBACK TAB.txt
Now the table is restored to its state when the database was at the time
specified by the timestamp. During the flashback table operation , Oracle is
created a temporary table. Table can be identified as SYS_TEMP_FBT.
FB RESTRICT.txt
FLASHBACK DROP
FLASHBACK DROP feature provides a way to restore accidentally dropped
tables. This feature is available even after restarting the database. Dropped
objects must NOT be created in SYSTEM tablespace. To know flashback drop,
first need to be clarified the " recycle bin " .
RECYCLE BIN
When a user drops a table , oracle renames the table to a system identifiable
string (starts with
BIN$) ,
bin. We cannot use DML or DDL statements on objects in the recycle bin.
Dropped table tab1 do not actually get deleted. Oracle just renames the
table i.e. System-generated name that begins with BIN$.
SQL> Purge table tab1
We can enable & disable the recycle bin with the recyclebin initialization
parameter at system level or session level. It is enabled by default in 10g.
When the recycle bin is enabled, dropped tables and their dependent objects
are placed in the recycle bin. When it is disabled, dropped tables & their
dependent objects are not placed in the recycle bin.
Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu
Who wants to drop the table permanently, use purge option. (dropped table
will not be in the recycle bin).
SQL> drop table <table_name> purge ;
SQL> drop table tab4 purge ;
FB_DROP.txt
FLASHBACK DATABASE
The Flashback database feature allows , DBA brings the entire database back
to a specific point -in time - that means going back to a previous database
state. This feature provides a way to quickly revert an entire Oracle database
to the past state (past point in time).
Oracle provides quickly recover database to a previous time to correct problems
caused by logical data corruptions or user errors. Flashback can fix logical
failures, but not physical failures. DBA cannot use the command to recover
accidental deletion of datafiles. This feature is good replacement for incomplete
recovery of full database. This is faster than traditional point-in-time recovery.
FLASHBACK LOGS
The Flashback database is not based on undo data but on flashback logs. If
flashback database is enabled , its flashback logs are stored in the Flash
Recovery area. Flashback database is implemented using a new type of log file
called Flashback database logs.
The oracle database server periodically receives (logs) before images of data
blocks in the flashback database logs. (Data block images are used to quickly
backing out changes to the datafiles during flashaback database).
When flashback database is enabled , a new RVWR background process is
started. This process is similar to the LGWR process. The new process writes
Flashback database data to the Flashback database logs. Flashback database
reduces the time required to recover the database to a previous point.
DATABASE
L
G
W
R
LGWR
RVWR
R
V
W
R
FLASHBACK
DATABASE
LOGS
REDO LOG
FILES
how far back into the past want to be able to restore the database i.e. how much
the flashback data, the database retains. This value is in minutes. The default
value for DB_FLASHBACK_RETENTION_TARGET is 1440 which is 24 hours.
SQL > alter system set DB_FLASHBACK_RETENTION_TARGET = 10080;
Once set these parameter, from that time, image copies of each altered block,
in every datafile into flashback logs stored in the flash recovery area. These
Flashback logs are used to flashback database to a point in time.
Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu
The Flash Recovery Area is defined by two initialization parameters. They are
DB_RECOVERY_FILE_DEST_SIZE & DB_RECOVERY_FILE_DEST.
DB_RECOVERY_FILE_DIST_SIZE specifies the size of the FRA and must be
FRA CONFIG.txt
In order to flashback the database we must have SYSDBA privilege and the flash
recovery area must have been configured in advance. We cant revert back the
database to a time more than db_flashback_retention_target value. The DBA
need to estimate the size of the FRA, and allocate disk storage.
Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu
Flashback the database to undo the changes made. We can perform the
flashback in either SQL*Plus or RMAN. ( examples given below).
FB DATABASE.txt
FB DB (rman).txt
POINTS TO NOTE