What is a Flash Recovery Area and How to Configure It
The Flash Recovery Area is an unified storage location for all recovery-related files and activitiesin an Oracle database. All the files you need to completely recover a database from a media failure are part of the Flash Recovery Area.
Flash recovery extends the functionality of Oracle Managed Files to all recovery related files (backup sets, image copies, and archived logs). It also provides automated space management, by deleting older files (based on a user specified retention policy) to make room for newer ones. The user specifies only the location of a Flash Recovery Area, and the amount of disk space that Oracle is allowed to use for recovery related files. This feature is integrated with the 10G MMON feature, so that out of space conditions can be handled through the standard Oracle monitoring framework.
Files Stored in the Flash Recovery Area
The files in Flash Recovery Area are classifed as permanent or transient:
– Permanent Files
The permanent files (assuming these are configured to be stored in the recovery area) are multiplexed copies of the current control file and online redo logs. These cannot be deleted without causing the instance to fail.
– Transient Files
Transient files including archived redo logs, datafile copies, control file copies, control file autobackups, backup pieces and flashback logs. Oracle manages these files automatically for deletion whenever space is required in the Flash Recovery Area. They are deleted once they become obsolete under the retention policy or have been backed up to tape even if not deleted are internally placed on a file can be deleted list. Until there is a backup of the file on disk made to a tertiary storage device it cannot be deleted.
Initialization Parameters for Flash Recovery Area
To enable the Flash Recovery Area, you must set the two initialization parameters:
– DB_RECOVERY_FILE_DEST_SIZE :
It is the disk limit, which is the amount of disk space the flash recovery area is permitted to use. The minimum size of the Flash Recovery Area should be at least large enough to contain archive logs that have not been copied to tape.
Note: This value does not include certain kinds of disk overhead:
-Block 0 or the OS block header of each Oracle file is not included in this size, so make sure to allow an extra 10% for this data when computing the actual disk usage required for the Flash Recovery Area.
DB_RECOVERY_FILE_DEST_SIZE does not indicate the real size occupied on disk when the underlying filesystem is mirrored, compressed, or in some other way affected by overhead not known to Oracle.
– DB_RECOVERY_FILE_DEST :
This initialization parameter is a valid destination to create the Flash Recovery Area. The destination can be defined as a directory, file system or ASM disk group.
Note: The Flash Recovery Area cannot be stored on a raw file system.
DB_RECOVERY_FILE_DEST_SIZE must be set before DB_RECOVERY_FILE_DEST. The two parameters must be set together to enable the FRA. In a RAC database, all instances must have the same values for these parameters. Even though there are multiple nodes they all share the same controlfiles.
Restrictions on Initialization Parameters
- You can not use the LOG_ARCHIVE_DEST and LOG_ARCHIVE_DUPLEX_DEST parameters to specify the redo log archive destinations. You must always use the LOG_ARCHIVE_DEST_n parameters in case you have configured flash recovery area.
- LOG_ARCHIVE_DEST_10 is implicitly set to USE_DB_RECOVERY_FILE_DEST if you create a recovery area and do not set any other local archiving destinations.
- Multiple database can have the same DB_RECOVERY_FILE_DEST only if the DB_NAME are different or if the DB_NAME is same (example the primary and standby database) then DB_UNIQUE_NAME parameter must different for the databases.
- For RAC the location of Flash Recovery Area must be on a cluster file system, ASM or a shared directory configured through NFS. The location and disk quotas must be the same on all instances.
How To Change Flash Recovery Area to a New Location
If you need to move the Flash Recovery Area of your database to a new location, invoke SQL*Plus to change the DB_RECOVERY_FILE_DEST initialization parameter.
Example: alter system set db_recovery_file_dest = ‘+ps89fn_disk’ scope=both sid=’*';
After you change this parameter, all new Flash Recovery Area files will be created in the new location.
The permanent files (control files and online redolog files), flashback logs and transient files can be left in the old Flash Recovery Area location. The database will delete the transient files from the old Flash Recovery Area location as they become eligible for deletion.
For the FLASHBACK logfiles to be able to pick up the new ‘db_recovery_file_dest’ location, the flashback option needs to be toggled on and off.
This can be done like this:
1. Shutdown the database
2. Startup mount the database
3. Toggle the Flashback off by alter database flashback off;
4. Toggle the Flashback on by alter database flashback on;
5. Open the database.
1. If you need to actually move your current permanent files, transient files, to the new Flash Recovery Area, then use the following command:
RMAN> BACKUP AS COPY ARCHIVELOG ALL DELETE INPUT;
RMAN> BACKUP DEVICE TYPE DISK BACKUPSET ALL DELETE INPUT;
2. To move the datafile copies, run the below command for each datafile copy:
RMAN> BACKUP AS COPY DATAFILECOPY DELETE INPUT;
where the is the datafilecopy name in the old recovery area.
3. To move the controlfile from the old FRA to new one, change the location in the parameter CONTROL_FILES to the new location and restart the instance in NOMOUNT:
RMAN> RESTORE CONTROLFILE FROM ‘filename_of_old_control_file>’;
4. To move the online redo logs, use the commands to add a log file stored in the new FRA and drop the logfile in the old FRA for each redo log group:
SQL> alter database add logfile size 100M;
SQL> alter database drop logfile ‘name of the old redo log’;
Oracle will clean up transient files remaining in the old FRA location as they become eligible for deletion.