The flash recovery area, which allows you to centralize storage of all recovery-related files, is new in Oracle 10g. The flash recovery area is an area of disk that is defined for use for recovery-related files. The flash recovery area can use locally attached storage, Clustered File Systems, or Oracle 10g's new Automated Storage Management (ASM) features.
The table below lists the file types that are backed up within the flash recovery area.
File Type | Notes |
---|---|
Control file | One copy of the control file is created in the flash recovery area when the database is created. |
Archived redo logs | When you configure the flash recovery area, the parameter log_archive_dest_10 is automatically configured, and archived redo logs are archived to that destination, as well as any other archive log destinations. |
Flashback logs | Flashback logs are stored in the flash recovery area, if it is defined. |
Control file autobackups | The default location for the RMAN control file autobackups is the flash recovery area, if it is defined. |
RMAN datafile copies | The default location for the RMAN datafile copies is the flash recovery area, if it is defined. |
RMAN backup and other related files | The default location for the RMAN files in general (backup-set pieces, etc.) is the flash recovery area, if it is defined. |
Databases should be in Archive log mode for flashback recovery. If a flash recovery area is configured, archival is enabled automatically and LOG_ARCHIVE_DEST_10 is configured to flash recovery area. If no default location for LOG_ARCHIVE_DEST is provided, then flash recovery area is used to store the archive logs. A single flash recovery area can be shared between more than one databases.
Reasons for Using the Flash Recovery Area
The flash recovery area:
- Provides a centralized storage area for all related recovery files
- Assists with the management of overall disk space allocation
- Provides for much faster backup and restore operations
The flash recovery area is created in a specific location (defined by a file system, or use of ASM).
The maximum size of the flash recovery area is defined via database parameters. As files are added or removed from the flash recovery area, records of these events are logged in the database alert log. The new DBA view, DBA_OUTSTANDING_ALERTS, allow you to check for information on outstanding issues with the flash recovery area, as shown in this example:
Select * from dba_outstanding_alerts;
Flash recovery parameters are dynamic. These parameters can be changed when the database is up and running. The following command changes the flashback recovery file to a different location than the original one.
ALTER SYSTEM SET DB_RECOVERY_FILE_DEST= '/u01/oradata/o10g/flash'
Flash recovery file size also can be dynamically changed. Setting the value of db_file_dest_size blank or null disables the flash recovery options. The following command changes the flash recovery file size:
ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE= ' ';
The RMAN retention policy determines retention for files in the flash recovery area. This is set via the RMAN configure retention policy command. If a file does not have a retention policy associated with it, or it's a permanent file, then it will never be deleted. If a file is not yet obsolete under the RMAN retention policy, then it will not be deleted. Archived logs are eligible for deletion once they are obsolete.
Space usage in the flash recovery area is automatically monitored by Oracle database. Warning messages are written to the alert logs when the space usage has reached 85% and a critical warning is issued when the space usage nears 97%. Oracle also removes files that are on the obsolete file list when there is less than 10 percent free space available. Alternatively dba_outstanding_alerts view can be queried to get the details about the warnings and suggested actions.
SELECT OBJECT_TYPE, MESSAGE_TYPE, MESSAGE_LEVEL, REASON, SUGGESTED_ACTION FROM DBA_OUTSTANDING_ALERTS
Note: Running out of space in the flash recovery area can be troublesome if that area is your only archive log destination, as this can eventually cause your database to shut down. If the flash recovery area is to be your only archive log destination, monitor space availability carefully.
Setting Up the Flash Recovery Area
To set up the flash recovery area, you need to configure the following parameters (which are new in Oracle 10g):
DB_RECOVERY_FILE_DEST_SIZE
Example:
Alter system set db_recovery_file_dest_size=20G scope=both;
Purpose:
This parameter sets the allocated size of the flash recovery area and must be defined in order to enable the flash recovery area.
You should not set this value to a size that is greater than the total amount of available disk space that is available to you. Otherwise, backups will fail.
DB_RECOVERY_FILE_DEST
Example:
Alter system set db_recovery_file_dest= '/u01/oracle/flash_recovery' scope=both;
Purpose:
This is the location of the flash recovery area. The parameter can be set to any valid file system, or you can use the Automatic Storage Management (ASM) disk group.
Note that if you do not specify the db_recovery_file_dest_size parameter before you specify the db_recovery_file_dest parameter, you will receive an ORA-32001 error message. In a similar fashion, you must disable the db_recovery_file_dest parameter before you reset the db_recovery_file_dest_size parameter. Leaving db_recovery_file_dest empty disables the flash recovery area. Here is an example of disabling the flash recovery area by resetting the db_recovery_file_dest parameter:
Alter system set db_recovery_file_dest=' ' scope=both;
You cannot specify these settings for a specific instance in an Oracle Real Application Clusters environment.
Flashback retention time is defined by the parameter db_flashback_retention_target. This parameter value is specified in seconds.
Flash Recovery Area Views
The V$RECOVERY_FILE_DEST view, new in Oracle 10g, provides an overview of the recovery area that is defined in your database, including:
- Disk space assigned to flash recovery area
- The amount of space used
- How much space can be reclaimed
- The number of files in the flash recovery area
A new column, IS_RECOVERY_DEST_FILE, can be found in a number of Oracle 10g's V$ views, including V$CONTROLFILE, V$LOGFILE, V$ARCHIVED_LOG, V$DATAFILE_COPY, and V$BACKUP_PIECE. This column is a Boolean that indicates whether or not the file is in a flash recovery area.
Another new column, BYTES, can be found in the views V$BACKUP_PIECE and RC_BACKUP_PIECE (an RMAN recovery catalog view). This column indicates the size, in bytes, of the backup-set piece. This can be used to help you determine how much of the flash recovery area your backups are already consuming.
Warning: Manually removing fixed files from the flash recovery area can have unexpected consequences. The space is not reclaimed because Oracle does not immediately detect the removal of these files. If you manually remove files (or loose a disk), use the RMAN crosscheck command along with the delete command to force Oracle to update the current control file information on the flash recovery area.
RMAN Commands Related to Flash Recovery Areas
RMAN has been enhanced with new commands that allow you to back up and restore the flash recovery area. The RMAN command backup recovery area allows you to back up all files required to restore the database via RMAN from a recovery area to an sbt (tape) device. The following types of files are backed up with this command:
- Full and incremental backup sets
- Control file autobackups
- Archive logs
- Datafile copies
Note that this command does not back up the following:
- Flashback logs
- Incremental bitmaps
- The current control file
- Online redo logs
The RMAN command backup recovery area backs up all files needed for recovery in the flash recovery area. There is a second command, backup recovery files, that backs up all recovery files that are on the disk, wherever they may be (in flash recovery areas or otherwise). The backup recovery files command must also go to an sbt device and cannot go to disk.
Note: The backup recovery area and backup recovery files commands are useful commands when you do your primary backups to disk but want to back up those backup sets to tape at a later date!
RMAN Backup and Restore to a Flash Recovery Area
When a flash recovery area is defined (via the db_recovery_file_dest parameter), RMAN sends backups directly to the flash recovery area. If you are using a local or CFS file system, you will find that RMAN creates a directory structure for the flash recovery area. Typically, the structure includes a directory for the database being backed up and, underneath that directory, another directory for the type of backup.
Recoveries also use the flash recovery area if the appropriate backup set is within the flash recovery area. Also, you can specify a recovery area to use when restoring a control file or SPFILE from an autobackup by using the new recovery area clause, as shown in this example:
RMAN> Restore controlfile from autobackup using recovery area 'c:\recovery';
Other Flash Recovery Area Features
The alter database add logfile and alter database add standby logfile commands, by default, now create an online redo log member in the flash recovery area if the OMF-related parameter db_create_online_log_dest_n is not set. The alter database drop logfile and alter database rename file commands also support files in the flash recovery area.
During database creation, Oracle Database 10g can use the flashback recovery area to store the database control file and online redo logs. If the OMF-related parameter db_create_online_log_dest_n is defined, then the control file and redo logs will be created in those locations, but will not be created in the flash recovery area, even if the flash recovery area is defined. If db_create_online_log_dest_n is not defined but create_file_dest is defined, then the control file and online redo logs will be created in the location defined by create_file_dest. If the parameter db_recovery_file_dest is also defined, then a copy of the control file and online redo logs will get created there as well. Finally, if only db_recovery_file_dest is defined, then the control file will get created in that location. If none of these parameters is defined, then the control file and online redo logs will be created to a default location, which is OS specific.
Start the discussion at forums.toadworld.com