Thursday, September 24, 2009

Restoring When Multiple Databases in the Catalog Share the Same Name: Example

As explained in the description for SET DBID in Oracle Database Recovery Manager Reference, you must run the SET DBID command to restore the control file when the target database is not mounted and multiple databases registered in the recovery catalog share the same name. In this case, do the following steps in order:
Start RMAN and connect to the target database.
Run the STARTUP FORCE NOMOUNT command.
Run the SET DBID command to distinguish this connected target database from other target databases that have the same name.
Run the RESTORE CONTROLFILE command. After restoring the control file, you can mount the database to restore the rest of the database.
This procedure avoids the RMAN-20005 message when you attempt to restore the control file. This message occurs because more than one target database has the same name, so RMAN requires the unique DBID to distinguishes the databases from one another.
Obtaining the DBID of a Database That You Need to Restore
If you have saved the RMAN output log files, then refer to these logs to determine the database identifier. RMAN automatically provides the DBID whenever you connect to the database:% rman TARGET /
Recovery Manager: Release 10.1.0.2.0 - Production
connected to target database: RMAN (DBID=1231209694)
The output from RMAN jobs is also stored persistently in V$RMAN_STATUS and RC_RMAN_STATUS.
The DBID is also stored in the RC_DATABASE and RC_DATABASE_INCARNATION recovery catalog views.
Because the names of the databases that are registered in the recovery catalog are presumed nonunique in this scenario, you must use some other unique piece of information to determine the correct DBID. If you know the filename of a datafile or online redo log associated with the database you wish to restore, and this filename is unique across all databases registered in the recovery catalog, then substitute this fully specified filename for filename_of_log_or_df in the following queries.
Determine the DBID by performing one of the following queries:
SELECT DISTINCT DB_ID
FROM DB, DBINC, DFATT
WHERE DB.DB_KEY = DBINC.DB_KEY
AND DBINC.DBINC_KEY = DFATT.DBINC_KEY
AND DFATT.FNAME = 'filename_of_log_or_df';

SELECT DISTINCT DB_ID
FROM DB, DBINC, ORL
WHERE DB.DB_KEY = DBINC.DB_KEY
AND DBINC.DBINC_KEY = ORL.DBINC_KEY
AND ORL.FNAME = 'filename_of_log_or_df';
Restoring a Backup Control File By Using the DBID
To set the DBID, connect RMAN to the target database and run the following SET command, where target_dbid is the value you obtained from the previous step:
SET DBID = target_dbid;
To restore the control file to its default location and then mount it, run:
RESTORE CONTROLFILE;
ALTER DATABASE MOUNT;
To restore and recover the database, run:
RESTORE DATABASE;
RECOVER DATABASE
# optionally, delete logs restored for recovery and limit disk space used
DELETE ARCHIVELOG MAXSIZE 2M;

No comments:

Post a Comment

About Me

Working as Oracle DBA for Wipro Technologies, Chennai, India