Wednesday, April 18, 2012

RMAN unregister and register after duplication

If you were using the RMAN catalog for the your auxiliary instance before duplication you will need to reregister it. The newly created duplicated instance now has a new DBID. This example will demonstrate how to reincarnate your database or simple cut to the chase and register a database with an rman catalog.

In my example I just completed an Active Duplication of my production instance to a development instance I call dev311.

Log onto the development server and dev311 database.

Using rman connect to the target and catalog.

% rman target / catalog login/xxxx@vcatdb

Recovery Manager: Release 11.2.0.2.0 - Production on Thu Apr 12 11:01:44 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: dev311 (DBID=3811178510)
connected to recovery catalog database

Note your new DBID. Now Query the catalog for the incarnation of dev311. You see that the DBID is not the same as your newly duplicated database.

RMAN> list incarnation of database dev311;

List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1841905798 1841905799 DEV311 3805185786 CURRENT 9804844295329 02-DEC-10

You will notice that the DBID for the registered version of dev311 is different than your current DBID of the dev311 database. The DBID has changed so we need to unregister and register our new DBID.

Exit RMAN and log in without connecting to the target, connect to the catalog only.

Set your DBID to the dev311 instance already known to the catalog and unregister the old instance.

# rman
Recovery Manager: Release 11.2.0.2.0 - Production on Thu Feb 24 08:01:44 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

RMAN>

RMAN> connect catalog login/passwd@catdb;
connected to recovery catalog database

RMAN> set dbid 3805185786; # this is the old DEV311 dbid.
executing command: SET DBID
database name is "DEV311" and DBID is 3805185786

RMAN> unregister database;
database name is "DEV311" and DBID is 3805185786
Do you really want to unregister the database (enter YES or NO)? y
database unregistered from the recovery catalog

RMAN> exit

Now exit RMAN and reconnect to the target and catalog.

RMAN> connect target / catalog login/passwd@catdb;

Recovery Manager: Release 11.2.0.2.0 - Production on Thu Apr 12 11:12:42 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: DEV311 (DBID=3811178510)
connected to recovery catalog database

Register the new database instance.

RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

RMAN> list incarnation of database dev311;

List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1992522226 1992522424 DEV311 3811178510 PARENT 1 02-DEC-10
1992522226 1992522227 DEV311 3811178510 CURRENT 9864858231054 12-APR-12

RMAN> list backup;
specification does not match any backup in the repository

Since you recreated the registration in the catalog you need to also reconfigure your default settings. Some of my important configuration are the following:

RMAN> run {
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 35 DAYS;
CONFIGURE DEFAULT DEVICE TYPE TO sbt;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE sbt TO '%F';
CONFIGURE DEVICE TYPE SBT_TAPE PARALLELISM 4;
CONFIGURE BACKUP OPTIMIZATION ON;
}

RMAN> crosscheck archivelog all;


Now backup your database.

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