Professional Documents
Culture Documents
Summary
Symptom Oracle Flashback Database
This note describes functions, configuration and the use of Oracle Flashback Database in the SAP environment. This note is valid for Oracle Releases 10.2 and 11.2.
Other terms
DB_FLASHBACK_RETENTION_TARGET V$FLASHBACK_DATABASE_LOG V$FLASHBACK_DATABASE_STAT V$RESTORE_POINT V$DATABASE Terminology SCN = System Change Number PITR = Point-in-time-Recovery PIT = Point-in-time Flashback Logging = Writing Flashback logs Flashback Window = Time interval for Flashback Database
Reason and Prerequisites Flashback Database and data inconsistency in a system landscape
Note that a temporal resetting of a database has major consequences for the data consistency in a system landscape. Therefore, a recovery concept should consider that logical errors in a production system should be corrected by other means if possible. For more information, see SAP Notes 434645 and 434647.
Also note that the Fast Recovery Area (as described in Note 966073) should be in a storage system that is as fast as possible and that has a fast I/O. If the Fast Recovery Area is in an I/O system that is too slow, Flashback Logging may lead to performance problems (wait event: flashback buf free by RVWR).
When you consider the status of the database after a Flashback Database operation, the result is identical to a Point-In-Time-Recovery (PITR) of the entire database. A normal Point-in-Time-Recovery consists of two steps: 1.) the reload of an entire database backup and 2.) the import of archive logs/recovery up until the required point of time. With a Flashback Database operation, however, the last changes starting from the current state of the database are reversed. Compared to a normal PITR, the Flashback Database operation is significantly faster and easier, and therefore provides a good alternative to the normal PITR procedure.
17.10.2011
For such application cases, you define one (or more) guaranteed restore points, but no normal Flashback Logging.
Recommendations
Depending on the case (see above), you should either activate normal Flashback Logging only (ALTER DATABASE FLASHBACK ON), or create guaranteed restore points only (CREATE RESTORE POINT <NAME> GUARANTEE FLASHBACK DATABASE). However, due to space restrictions and for performance reasons, both variants should not be active at the same time.
between the time the block was copied to the Flashback Log and the required recovery target time are also implemented using Archive Logs. Flashback Database therefore not only requires Flashback Logs, but also the relevant Archive Logs for the desired period of time (flashback retention target). Therefore, the database must run in ARCHIVELOG mode (this is always the case for SAP databases). If the RVWR background process detects problems when writing Flashback Logs, the following occurs: If a Flashback Log cannot be written correctly for a guaranteed restore point (see below), the Oracle instance terminates. This behavior becomes clear when you consider the purpose of guaranteed restore points and the possible usage scenarios. For Flashback Logging activated in the usual way, an I/O problem of the RVWR results in the deactivation of Flashback Logging, but the instance keeps running (exception: standby database). During FLASHBACK DATABASE, only the database files are returned to an earlier state, but not the auxiliary files such as Oracle password files, Oracle profile files, Oracle Wallet files, or Oracle control files. Flashback Logs are not backed up. Therefore, you do not need to adjust the database backup strategy to also backup Flashback Logs. Flashback Logs are deleted automatically from the Flash Recovery Area by the Oracle server as soon as they are no longer needed or if space is required in the Flash Recovery Area for other, more important files.
possible, changed blocks from the Oracle buffer cache are only written to the Flashback Logs in certain, fixed intervals. Therefore, not every version of a data block is written to the Flashback Logs. (See below: Variants of Flashback Logging.) Recommendations for Flash Recovery Area (see also Note 966073): o For the Flash Recovery Area, a fast file system should be used, if possible, without operating system caching File system with high throughput
To monitor the system performance, the views V$FLASHBACK_DATABASE_STAT and V$SYSSTAT are available.
After such operations, the Flashback Database time window starts again from the beginning.
If the database is to be reset using Flashback Database to a point of time at which a NOLOGGING operation was running, the affected data blocks will probably be inconsistent or corrupt. For this reason, this should be avoided. You can achieve this by replacing the NOLOGGING operation with a LOGGING operation or by triggering a full backup or incremental backup of the affected data files directly after a NOLOGGING operation. The time span specified in the parameter DB_FLASHBACK_RETENTION_TARGET is to be understood as target. Oracle cannot guarantee this time span (exception: guaranteed restore points, see below). Only if enough space is available for the Flashback logs can the required Flashback retention (retention period of Flashback logs) be adhered to.
17.10.2011
Page 5 of
12
Both variants are based on Flashback Logs and allow the use of FLASHBACK DATABASE to revert the database to an earlier state. Normal Flashback Logging is activated explicitly by activating the FLASHBACK mode. Flashback Logging for a guaranteed restore point is automatically or implicitly activated when a guaranteed restore point is created. The difference between those variants is, aside from the way Flashback logging is activated, in the possible points of time to which the database can be reverted using FLASHBACK DATABASE. o With normal Flashback Logging, you can reset the database to any point of time (that is covered by the Flashback Logs). The SCN area covered by the Flashback Logs is called a Flashback Database time window. This timeframe should cover at least the defined Flashback retention. If sufficient space is not available in the Flash Recovery Area, the oldest Flashback Logs are overwritten. The desired Flashback retention is ignored. The concept of guaranteed restore points offers the option to reset the database to exactly the same state it was in at the time of the guaranteed restore point (but not at any other earlier or later point in time). Guaranteed restore points are therefore particularly suitable for situations prior to larger and critical database operations (for example, an SAP upgrade or an Oracle patchset installation). If this operation fails, you can use FLASHBACK DATABASE to reset the database (even repeatedly) to the point of time at the beginning of the operation without having to reload a database backup.
Normal Flashback Logging and guaranteed restore points can be used independently of each other. However, we recommend not to activate both variants at the same time (see below: Variants of Flashback Logging).
With normal Flashback Logging, changed blocks are written to the Flashback Logs at fixed intervals. If a block is changed at different points of time, it is saved several times in the Flashback Log.
17.10.2011 Page 6 of 12
If a guaranteed restore point has been defined and normal Flashback Logging has not additionally been activated, the block is written to the Flashback Log when it is changed the first time. If the block is changed, this changed block is not saved again. This way, you can reset the database only to the guaranteed restore point using the block information saved in the Flashback Logs, but not to any point in time before or after. Each block that was changed is saved exactly once in a Flashback Log. Because every changed block is only written to the Flashback Log once, Flashback Logging for guaranteed restore points is less time-consuming or extensive (less I/O) than normal Flashback Logging. You can therefore run a guaranteed restore point for several days or weeks without any concerns regarding space requirements for Flashback Logs (even if the Flashback Log are not deleted). Due to the reduced I/O, the effect of Flashback Logging for guaranteed restore points on performance is less when compared to normal Flashback Logging. If normal Flashback Logging has been activated and if several guaranteed restore points have also been defined, the database uses normal Flashback Logging. However, Flashback Logs cannot be deleted as of the first GRP. For this reason, you must monitor the free space in the Flash Recovery Area closely, to prevent the database from terminating or hanging due to space problems in the Flash Recovery Area. We therefore do not recommend to use normal Flashback logging and GRP at the same time. With regard to the space usage and the automatic administration of Flashback Logs in the Flash Recovery Area, the following differences exist: Flashback Logs that are written for a GRP are not deleted automatically. They are required to guarantee the reset of the database to the GRP. They are only deleted together with the relevant GRP. Therefore, a GRP should be deleted if it is no longer required. With normal Flashback Logging, Flashback Logs are overwritten after the specified Flashback retention target. The Flashback retention is defined by the parameter DB_FLASHBACK_RETENTION_TARGET. If there is not enough space in the Flash Recovery Area to save the Flashback Logs for the required Flashback retention, the oldest Flashback Logs are overwritten first. The desired Flashback retention is not guaranteed.
Restore Points
You use a restore point to define a restart point at which you want to reset the database. A restore point acts as a bookmark and marks a certain point of time. You can define a restore point, for example, before a critical or unstable operation. If the operation actually fails and you want to reset the database to the status before this operation, you only have to execute a Flashback Database with the restore point define previously. There are two types of restore points: Normal restore points and guaranteed restore points.
You can use normal restore points with the following commands: - RECOVER DATABASE - FLASHBACK DATABASE Prerequisites to create an NRP: none Guaranteed restore points: (GRP) guarantee the option to execute a Flashback Database to the SCN or the point of time of the GRP, even if normal Flashback Logging has not been activated in the database. If Flashback Logging is active, all Flashback Logs from the oldest GRP onwards are not deleted, and a possible Flashback Database back to any point of time between the oldest GRP and now is always guaranteed. Here, the following restrictions apply. Certain database operations cannot be undone using Flashback Database (see above). - Datafile Shrink - Drop Tablespace Prerequisites to create a GRP: o o o o COMPATIBLE to 10.2.0 and higher A Flash Recovery Area is configured (see Note 966073) The database runs in ARCHIVELOG mode. If normal Flashback Logging has not been activated, the database must have mount status when the first GRP is defined.
Administration
The following administrative tasks belong to Flashback Database: o o o o o Create the Flash Recovery Area. See Note 966073. Activate/deactivate normal Flashback Logging (see below) Create and delete GRPs (see below) Monitor performance (see below, flashback buf free by RVWR) Monitor free space in the Flash Recovery Area The size of the Flash Recovery Area is determined from the monitoring result (see below).
17.10.2011
Page 8 of
12
Deactivate: SQL> ALTER DATABASE FLASHBACK OFF; BRSPACE Action: brspace -fboff The following query determines whether Flashback Logging is active: SQL> SELECT FLASHBACK_ON FROM V$DATABASE;
V$RESTORE_POINT
How much space is used by Flashback Logs for each GRP? SQL> SELECT NAME, SCN, STORAGE_SIZE FROM V$RESTORE_POINT WHERE GUARANTEE_FLASHBACK_DATABASE = 'YES'; How much space do all GRP Flashback Logs use? SQL> SELECT SUM(STORAGE_SIZE) FROM V$RESTORE_POINT WHERE GUARANTEE_FLASHBACK_DATABASE = 'YES';
The following SQL command determines the oldest SCN in the Flashback Logs: SQL> SELECT OLDEST_FLASHBACK_SCN, TO_CHAR(OLDEST_FLASHBACK_TIME, 'YYYY-MON-DD HH24:MI:SS') FROM V$FLASHBACK_DATABASE_LOG; CAUTION: Certain database operations restart the Flashback window (for example, Drop Tablespace). This query does not take this restriction into account. The following SQL command determines the current SCN of the database: SQL> SELECT CURRENT_SCN FROM V$DATABASE;
17.10.2011
Page 10 of
12
4b. Option 2: Recover database up to current point of time RMAN> RECOVER DATABASE; With this, the Flashback Database command is undone and the database is brought back to its current state. 4c. Option 3: Another Flashback Database to an earlier SCN RMAN> FLASHBACK DATABASE TO SCN <scn number>; If the point of time was selected incorrectly (too late), you can use the Flashback command again to go even further back in the past. 4d. Option 4: Recover database for a later SCN RMAN> RECOVER DATABASE UNTIL SCN <scn number>; If the point of time was selected incorrectly (too early), you can move the recovery of the database towards the current point of time. For further example scenarios, refer to the Oracle documentation.
17.10.2011
Page 11 of
12
A normal restore point is deleted automatically from the control file if it is older than specified in parameter CONTROL_FILE_RECORD_KEEP_TIME. Independent of this time restriction, the last 2048 restore points remain saved in the control file. A GRP remains active and in the control file until it is deleted explicitly.
Header Data
Release Status: Released on: Master Language: Priority: Category: Primary Component: Secondary Components: BC-DB-ORA-DBA Database Administration with Oracle Released for Customer 19.07.2011 12:13:51 German Recommendations/additional info Consulting BC-DB-ORA Oracle
Related Notes
Number 1125923 966073 937492 828268 434647 434645 105047 Short Text Support for Oracle database flashback in BR*Tools Oracle Flash Recovery Area/Fast Recovery Area FAQ: Oracle Flashback Oracle Database 10g: New functions Point-in-time recovery in an SAP system group Point-in-time recovery: What must I be aware of? Support for Oracle functions in the SAP environment
Attributes
Attribute Database system Value ORACLE
17.10.2011
Page 12 of
12