RMAN 11g New Feature – Backup Fast Recovery Area (FRA) to Disk _ Oracle DBA – Tips and...

5
« Migrating the 11i E-Business Suite database to Linux Home GoldenGate IGNOREDELETES, IGNOREUPDATES and using the LOGDUMP utility » RMAN 11g new feature - Backup Fast Recovery Area (FRA) to Disk 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_.b 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_ 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: RMAN 11g new feature – Backup Fast Recovery Area (FRA) to Disk « Oracle DBA – Tips and ... http://gavinsoorma.com/2012/08/rman-11g-new-feature-backup-fast-recovery-area-fra-to-disk/ 1 of 5 6/7/2014 3:41 PM

description

RMAN 11g New Feature – Backup Fast Recovery Area (FRA) to Disk _ Oracle DBA – Tips and Techniques

Transcript of RMAN 11g New Feature – Backup Fast Recovery Area (FRA) to Disk _ Oracle DBA – Tips and...

  • Migrating the 11i E-Business Suite database to Linux Home GoldenGate IGNOREDELETES, IGNOREUPDATES and using the LOGDUMP utility

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

    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 NFSattached 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 belocated 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 allstored 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 FastRecovery 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 onein 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_.b

    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_

    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 hascrashed.

    To simulate a total server crash I do the following:

    RMAN 11g new feature Backup Fast Recovery Area (FRA) to Disk Oracle DBA Tips and ... http://gavinsoorma.com/2012/08/rman-11g-new-feature-backup-fast-recovery-area-fra-to-disk/

    1 of 5 6/7/2014 3:41 PM

  • Shutdown the database.Rename the directory holding the data files of the databaseRename the spfile and init.ora fileRename 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 parametersLRM-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 spfileOracle instance started

    Total System Global Area 158662656 bytes

    Fixed Size 2211448 bytesVariable Size 92275080 bytesDatabase Buffers 58720256 bytesRedo Buffers 5455872 bytes

    RMAN> restore spfile from '/mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_ncsnf_TAG20120528T080501_7w5oo92

    Starting restore at 28-MAY-12using 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_channel ORA_DISK_1: SPFILE restore from AUTOBACKUP completeFinished 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 bytesVariable Size 490735968 bytesDatabase Buffers 301989888 bytesRedo Buffers 6758400 bytes

    RMAN 11g new feature Backup Fast Recovery Area (FRA) to Disk Oracle DBA Tips and ... http://gavinsoorma.com/2012/08/rman-11g-new-feature-backup-fast-recovery-area-fra-to-disk/

    2 of 5 6/7/2014 3:41 PM

  • RESTORE CONTROFILE

    RMAN> restore controlfile from '/mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_ncsnf_TAG20120528T080501_7

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

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

    RMAN> alter database mount;

    database mountedreleased 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_.bkpFile Name: /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_annnn_TAG20120528T093614_7w5ongvb_.bkpFile Name: /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_ncsnf_TAG20120528T080501_7w5oo92y_.bkpFile 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)? YEScataloging 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_.bkpFile Name: /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_annnn_TAG20120528T093614_7w5ongvb_.bkpFile Name: /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_ncsnf_TAG20120528T080501_7w5oo92y_.bkpFile 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-12using channel ORA_DISK_1

    channel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup set

    RMAN 11g new feature Backup Fast Recovery Area (FRA) to Disk Oracle DBA Tips and ... http://gavinsoorma.com/2012/08/rman-11g-new-feature-backup-fast-recovery-area-fra-to-disk/

    3 of 5 6/7/2014 3:41 PM

  • channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/sqlfun/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/sqlfun/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/sqlfun/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/sqlfun/users01.dbfchannel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/sqlfun/threatened_fauna_data.dbfchannel ORA_DISK_1: reading from backup piece /mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_nnndf_TAG2012channel ORA_DISK_1: piece handle=/mnt/remote/backups/orasql/FRA_BACKUP/SQLFUN/backupset/2012_05_28/o1_mf_nnndf_TAG20120528T080501_7channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:55Finished 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-12using channel ORA_DISK_1

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

    Finished recover at 28-MAY-12

    RMAN 11g new feature Backup Fast Recovery Area (FRA) to Disk Oracle DBA Tips and ... http://gavinsoorma.com/2012/08/rman-11g-new-feature-backup-fast-recovery-area-fra-to-disk/

    4 of 5 6/7/2014 3:41 PM

  • RMAN> alter database open resetlogs;

    database opened

    Ask me now!

    I'm a database wizpert

    August 3rd, 2012 | Tags: backup FRA, backup recovery area to destination, oss, recover, restore | Category: Backup and Recovery, Oracle 11g release 2

    RMAN 11g new feature Backup Fast Recovery Area (FRA) to Disk Oracle DBA Tips and ... http://gavinsoorma.com/2012/08/rman-11g-new-feature-backup-fast-recovery-area-fra-to-disk/

    5 of 5 6/7/2014 3:41 PM