DBA Tips Archive for Oracle

  


How to Restore the controlfile using RMAN

by Jeff Hunter, Sr. Database Administrator


Contents

  1. Overview
  2. Examples



Overview

Oracle provides many ways to restore the controlfile for recovery using RMAN (Recovery Manager). This article provides several examples of how to get the controlfile back quickly so the restore of the database can occur.

  If you do not specify the location where to restore the controlfile to, the parameter control_files is used with the respective names and locations listed in the parameter file (init.ora or spfile).

Several of the examples in this article make use the autobackup controlfile created by RMAN. By default, the format of the autobackup file for all configured devices is the substitution variable %F in the FORMAT clause. This variable format translates into c-IIIIIIIIII-YYYYMMDD-QQ, with the placeholders defined as follows:
    IIIIIIIIII stands for the DBID.

    YYYYMMDD is a time stamp of the day the backup is generated.

    QQ is the hex sequence that starts with 00 and has a maximum of FF.

Example OMF autobackup controlfile:

    o1_mf_s_716574721_5wn6p1hj_.bkp



Examples

The following examples use Oracle Database 10g and make use of a Recovery Catalog and the Flash Recovery Area (FRA).

1.   Restore controlfile from autobackup.


RMAN> restore controlfile from autobackup;

2.   Restore controlfile from a specific backup piece.


RMAN> restore controlfile from '/backup_dir/piece_name';

3.   Restore controlfile from most recent available controlfile backup.


RMAN> restore controlfile;

The following examples use Oracle Database 10g and do not require the use of a Recovery Catalog or a Flash Recovery Area (FRA). The big difference is the requirement to set the dbid of the database before executing restore with the instance in a nomount state.

4.   The following backup used all defaults. If not using a FRA, this backup should be in $ORACLE_HOME/dbs.


RMAN> set dbid=nnnnnnnnn; RMAN> restore controlfile from autobackup;

5.   Restore from autobackup looks at the most recent 7 days backups by default. If you want to restore an autobackup that's older then the default you can use the 'maxdays' parameter..


RMAN> set dbid=nnnnnnnnn; RMAN> restore controlfile from autobackup maxdays 20;

6.   Restore from autobackup increasing the number of autobackup sequences looked for restore in case your database generated many autobackups in a given day.


RMAN> set dbid=nnnnnnnnn; RMAN> restore controlfile from autobackup maxseq 10;

7.   Restoring from autobackup when the backup location is not default.


RMAN> set dbid=nnnnnnnnn; RMAN> set controlfile autobackup format for device type disk to '/tmp/%F'; RMAN> restore controlfile from autobackup;

8.   Restore the controlfile from this specific autobackup.


RMAN> set dbid=nnnnnnnnn; RMAN> restore controlfile from '/tmp/c-1140771490-20080502-03';

9.   Restore the controlfile from a specific autobackup file to a temporary disk location the replicate the temp controlfile to the respective locations and names given in control_files..


RMAN> set dbid=nnnnnnnnn; RMAN> restore controlfile from '/tmp/c-1140771490-2008050203' to '/tmp/control.tmp'; RMAN> replicate controlfile from '/tmp/control.tmp'

Once you have the controlfile restored and mounted you have access to your previous backup configuration which will also be used during restore as well as the backup information required to restore and recover your database. After you mount the controlfiles from Oracle101g 10.2.x > you can use the RESTORE PREVIEW command to see what backups will be required to restore and recover and what checkpoint you must exceed to open the database resetlogs.



About the Author

Jeffrey Hunter is an Oracle Certified Professional, Java Development Certified Professional, Author, and an Oracle ACE. Jeff currently works as a Senior Database Administrator for The DBA Zone, Inc. located in Pittsburgh, Pennsylvania. His work includes advanced performance tuning, Java and PL/SQL programming, developing high availability solutions, capacity planning, database security, and physical / logical database design in a UNIX / Linux server environment. Jeff's other interests include mathematical encryption theory, tutoring advanced mathematics, programming language processors (compilers and interpreters) in Java and C, LDAP, writing web-based database administration tools, and of course Linux. He has been a Sr. Database Administrator and Software Engineer for over 20 years and maintains his own website site at: http://www.iDevelopment.info. Jeff graduated from Stanislaus State University in Turlock, California, with a Bachelor's degree in Computer Science and Mathematics.



Copyright (c) 1998-2017 Jeffrey M. Hunter. All rights reserved.

All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express, prior, written permission. Application to host any of the material elsewhere can be made by contacting me at jhunter@idevelopment.info.

I have made every effort and taken great care in making sure that the material included on my web site is technically accurate, but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction.

Last modified on
Saturday, 18-Sep-2010 17:49:48 EDT
Page Count: 98899