Wednesday, July 28, 2010

Using RMAN Catalog to get the DBID for your database for recovery

Please use RMAN and RMAN Recovery Catalog for all of your database backups. If you are not, stop what you are doing and FIX IT! You’ll be glad you did when (not if) you need to restore your database from a catastrophic failure (yes, I know this from experience).

If you need to restore your database including your spfile and control file, you’ll need to know the DBID of the database. You should have a record the DBID before disaster strikes, but in the event you don't there's still hope, and if you are using an RMAN catalog, that hope is just a few commands away. My backup process (RMAN including catalog, and NetBackup) includes an email sent to me upon completion, so I always have important database information in my email archives. If you have an RMAN catalog (and you should) you can get easily get the DBID of your database.

-- In this example the database is down.
-- From your target start RMAN and connect to the catalog.

First restore your file system if necessary. We want our init.ora to start the database.

#rman target / catalog rman_user/rman_user_passwd@RCVCAT
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Jul 28 09:25:27 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: HRPROD (not mounted)
connected to recovery catalog database

-- The DBID is listed in RED below with the following RMAN command:

RMAN> list incarnation of database HRPROD;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
191122317 198582218 HRPROD 3800958841 CURRENT 1 25-JUN-10

-- Set your DBID while connected to RMAN

RMAN> SET DBID 3800958841;
executing command: SET DBID
database name is "DEV" and DBID is 3800958841

-- You can now proceed with the SPFILE restore, restore controlfile from autobackup, and restore database.


RMAN> startup nomount pfile='$ORACLE_HOME/dbs/inithrprod.ora';
Oracle instance started

RMAN>restore spfile from autobackup;



No comments:

Post a Comment

Oracle runInstaller fails on Linux, Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set.

How to get Oracle's runInstaller to run on Linux or Unix environment using from Windows using Cygwin as an xterm emulator. Download an...