Skip to content
Home » Oracle » How to Enable Fast Recovery Area (FRA)

How to Enable Fast Recovery Area (FRA)

Fast Recovery Area (FRA)

Fast Recovery Area (FRA) is a very convenient feature for DBA to backup and restore database. You may set the FRA destination during database creation, but chances are, you may leave FRA option unchecked.

In this post, we suppose that you want to enable FRA after the database has been created.

Enable FRA

There're 3 statements make your database starting to use FRA.

  1. Set FRA size.
  2. SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE=20G SCOPE=BOTH;

    System altered.

    The size must be set before setting FRA destination.

  3. Set FRA destination.
  4. SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST='+DATA' SCOPE=BOTH;

    System altered.

    If your database uses ASM as an infrastructure, the only valid value for this parameter is a disk group name like +DATA or +FRA, not the location. A location like +DATA/DBNAME/Fast_Recovery_Area is an invalid value, the database will refuse to change.

  5. Change the default archive destination to FRA.
  6. For normal cases, it's easy to set the destination of archived logs like this.

    SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION="USE_DB_RECOVERY_FILE_DEST"' SCOPE=BOTH;

    System altered.

    For data guard environments, it might be more complicated.

    SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION="USE_DB_RECOVERY_FILE_DEST" VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=primdb' SCOPE=BOTH;

    System altered.

    Actually, there're several ways that can change the archived log destination back to FRA.

Test FRA

Let's do some tests and see the result in the new archive log destination. First of all, we switch a log file to force current redo log to be archived.

SQL> ALTER SYSTEM SWITCH LOGFILE;

System altered.

SQL> SELECT sequence#, name FROM v$archived_log ORDER BY 1 DESC;

SEQUENCE# NAME
--------- ------------------------------------------------------------------
      450 +DATA/primdb/archivelog/2015_02_28/thread_1_seq_450.1050.797430797
      449 +DATA/compdb/archive/1_449_761506196.arc
      448 +DATA/compdb/archive/1_448_761506196.arc
...

As you can see, logs switched their location from the old one to FRA since log sequence 450.

Furthermore, we can backup database to FRA without specifying disk format after we enable fast recovery area.

RMAN> backup database;

Starting backup at 28-Feb-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=119 instance=primdb1 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00002 name=+DATA/compdb/datafile/sysaux.257.761506023
input datafile file number=00001 name=+DATA/compdb/datafile/system.256.761506017
input datafile file number=00003 name=+DATA/compdb/datafile/undotbs1.258.761506025
input datafile file number=00005 name=+DATA/compdb/datafile/example.264.761506243
input datafile file number=00006 name=+DATA/compdb/datafile/undotbs2.265.761506625
input datafile file number=00004 name=+DATA/compdb/datafile/users.259.761506027
channel ORA_DISK_1: starting piece 1 at 28-Feb-15
channel ORA_DISK_1: finished piece 1 at 28-Feb-15
piece handle=+DATA/primdb/backupset/2015_02_28/nnndf0_tag20150228t133021_0.1051.797434225 tag=TAG20150228T133021 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:03:26
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 28-Feb-15
channel ORA_DISK_1: finished piece 1 at 28-Feb-15
piece handle=+DATA/primdb/backupset/2015_02_28/ncsnf0_tag20150228t133021_0.1052.797434437 tag=TAG20150228T133021 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 28-Feb-15

The result shows that RMAN backup database to FRA as expected.

If your database is in a data guard environment, for symmetry, don't forget to set the above 3 initialization parameters on the standby database by yourself. Because the data guard will not transport changes of SPFILE from the primary database to the standby.

Leave a Reply

Your email address will not be published. Required fields are marked *