Saturday, July 07, 2012

When to use SET DBID in RMAN


Usage of SET DBID in RMAN

You should only run the SET DBID command in the following specialized circumstances:
  • You are not connected to a recovery catalog and want to restore the control file or server parameter file (SPFILE)
  • You are connected to a recovery catalog want to restore the control file, but the database name is not unique in the recovery catalog.
  • The server parameter (SPFILE) file is lost and you want to restore it.
Example:

The following shell script uses the DBID to restore the control file because multiple target databases share the same DB_NAME in the catalog. After you have restored the target control file, you can mount the database to restore the rest of the database:
#!/usr/bin/tcsh
rman TARGET / CATALOG rman/rman@catdb <<EOF
STARTUP FORCE NOMOUNT;
SET DBID = 862893450; # needed to distinguish target from others with same DB_NAME
RESTORE CONTROLFILE; # assuming catalog has automatic channel allocation information
ALTER DATABASE MOUNT;
EOF
If  you do not set the SET DBID clause, system will report error below;
 “RMAN-20005: target database name is ambiguous” .