News
Perth, Australia
+ (61) 417713124
prosolutions@gavinsoorma.com

RMAN 11g new feature – Backup Fast Recovery Area (FRA) to Disk

  • Posted by Gavin Soorma
  • On August 3, 2012
  • 1 Comments
  • backup FRA, backup recovery area to destination, oss, recover, restore

 

In Oracle 11gR2, there is a good new feature whereby we can backup the fast or flash recovery area to a disk location which could be a remote destination via a NFS attached file system.

In earlier releases, we could only backup the Flash Recovery Area to tape and not disk via RMAN.

Recovery from disk in most cases is significantly faster than recovery from a tape device especially when we have a very large tape library and the right tape needs to be located or maybe we have a case where all tape drives are already in use and we have to perform a critical database recovery at the same time.

The OSS or Oracle Suggested Strategy for backups involves a disk based backup method and level 0 datafile copies and subsequent leevl 1 incremental backupsets are all stored on local disk.

So what happens if we lose the local server and with it all our disk based backups? – we have to do a full database restore from tape which can be very time consuming.

The 11g RMAN command BACKUP RECOVERY AREA TO DESTINATION lets us specify a secondary backup location for all our backups which are stored in the Fast Recovery Area.

In this example we are backing up the FRA on a daily basis after the OSS backup to disk completes via the command:

backup recovery area to destination ‘/mnt/remote/backups/orasql/FRA_BACKUP/’

If we run a LIST BACKUP OF DATABASE we can see that there are two copies of the backupset #479. One stored in the FRA on the local server /u01 file system and one in the remote location which is a file server attached via NFS to the local server.

List of Backup Pieces for backup set 479 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    565     1   AVAILABLE   /u01/app/oracle/flash_recovery_area/SQLFUN/backupset/2012_08_01/o1_mf_nnnd1_ORA_OEM_LEVEL_0_81jgs7qf_.bkp

  Backup Set Copy #2 of backup set 479
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:00:18     01-AUG-12       NO         ORA_OEM_LEVEL_0

    List of Backup Pieces for backup set 479 Copy #2
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    571     1   AVAILABLE   /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_08_01/o1_mf_nnnd1_ORA_OEM_LEVEL_0_81jh0x4l_.bkp

Let us now test a restore using this remote backup location by simulating a total server failure where we lose all our disk based backups residing on the local server which has crashed.

To simulate a total server crash I do the following:

Shutdown the database.
Rename the directory holding the data files of the database
Rename the spfile and init.ora file
Rename the FRA directory for the database so that RMAN cannot find the local backups in the FRA

When we perform the restore and recovery, RMAN finds that it cannot access the backups stored in the FRA (because we have renamed the directory).

It will now try and restore the copy of the FRA backups which was stored in the remote location.

This can be seen from the RMAN ouput like “reading from backup piece /mnt/remote/backups/orasql/FRA_BACKUP” ….
RESTORE SPFILE

RMAN> startup force nomount;

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initsqlfun.ora'

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area     158662656 bytes

Fixed Size                     2211448 bytes
Variable Size                 92275080 bytes
Database Buffers              58720256 bytes
Redo Buffers                   5455872 bytes

RMAN> restore spfile from '/mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_ncsnf_TAG20120528T080501_7w5oo92y_.bkp';

Starting restore at 28-MAY-12
using channel ORA_DISK_1

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_ncsnf_TAG20120528T080501_7w5oo92y_.bkp
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 28-MAY-12

RMAN> shutdown immediate;

Oracle instance shut down

RMAN> startup nomount;

connected to target database (not started)
Oracle instance started

Total System Global Area     801701888 bytes

Fixed Size                     2217632 bytes
Variable Size                490735968 bytes
Database Buffers             301989888 bytes
Redo Buffers                   6758400 bytes

RESTORE CONTROFILE

RMAN> restore controlfile from  '/mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_ncsnf_TAG20120528T080501_7w5oo92y_.bkp';

Starting restore at 28-MAY-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=134 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/sqlfun/control01.ctl
output file name=/u01/app/oracle/flash_recovery_area/sqlfun/control02.ctl
Finished restore at 28-MAY-12

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RESTORE DATABASE

RMAN> catalog start with  '/mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN';

searching for all files that match the pattern /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN

List of Files Unknown to the Database
=====================================
File Name: /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_annnn_TAG20120528T081134_7w5oob2y_.bkp
File Name: /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_annnn_TAG20120528T093614_7w5ongvb_.bkp
File Name: /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_ncsnf_TAG20120528T080501_7w5oo92y_.bkp
File Name: /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_nnndf_TAG20120528T080501_7w5onhys_.bkp

Do you really want to catalog the above files (enter YES or NO)? YES
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_annnn_TAG20120528T081134_7w5oob2y_.bkp
File Name: /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_annnn_TAG20120528T093614_7w5ongvb_.bkp
File Name: /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_ncsnf_TAG20120528T080501_7w5oo92y_.bkp
File Name: /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_nnndf_TAG20120528T080501_7w5onhys_.bkp

RMAN> restore database;

Starting restore at 28-MAY-12
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/sqlfun/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/sqlfun/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/sqlfun/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/sqlfun/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/sqlfun/threatened_fauna_data.dbf
channel ORA_DISK_1: reading from backup piece /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_nnndf_TAG20120528T080501_7w5onhys_.bkp
channel ORA_DISK_1: piece handle=/mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_nnndf_TAG20120528T080501_7w5onhys_.bkp tag=TAG20120528T080501
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:55
Finished restore at 28-MAY-12

RECOVER DATABASE

RMAN> list backup of archivelog all;

List of Backup Sets
===================

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
164     68.50K     DISK        00:00:00     28-MAY-12
        BP Key: 164   Status: AVAILABLE  Compressed: NO  Tag: TAG20120528T081134
        Piece Name: /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_annnn_TAG20120528T081134_7w5oob2y_.bkp

  List of Archived Logs in backup set 164
 Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    386     8176419    28-MAY-12 8176669    28-MAY-12

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
165     68.50K     DISK        00:00:00     28-MAY-12
        BP Key: 165   Status: AVAILABLE  Compressed: NO  Tag: TAG20120528T093614
        Piece Name: /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_annnn_TAG20120528T093614_7w5ongvb_.bkp

  List of Archived Logs in backup set 165
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    386     8176419    28-MAY-12 8176669    28-MAY-12

RMAN> recover database until sequence 387;

Starting recover at 28-MAY-12
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:01

Finished recover at 28-MAY-12

RMAN> alter database open resetlogs;

database opened
 

1 Comments

brian choy
  • Jun 7 2017
Excellent feature that make our data more robust, I have yet to test it out

Leave Reply

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