Sunday, March 23, 2008

Recovery catalog for RMAN backup

Print this post

Why Recovery catalog ?

It is always recommended to have the recovery catalog. If the target database controlfiles are lost recovery can become difficult if not impossible.Having recovery catalog makes the DBA life easier at the time of critical scenario. Even for larger system the use of a recovery catalog can increase the backup performance.

Recovery Catalog Schema can be created in the Target database or in any test or development database. It is  not at all recommended  to create the recovery catalog in the target database itself. Make sure to have a separate database for the recovery catalog always .Also its recommended to create the recovery catalog database in a different machine. If creating the Recovery catalog database in different machine is not possible then ensure that the recovery catalog and target databases do not reside on the same disk. If both your recovery catalog and your target database suffer hard disk failure, your recovery process is much more difficult. If possible, take other measures as well to eliminate common points of failure between your recovery catalog database and the databases you are backing up.

The recovery catalog contains information about RMAN operations, including:

+ Datafile and archived redo log backup sets and backup pieces
+ Datafile copies
+ Archived redo logs and their copies
+ Tablespaces and datafiles on the target database
+ Stored scripts, which are named user-created sequences of RMAN commands
+ Persistent RMAN configuration settings

How to create recovery catalog ?

Creating recovery catalog is a 3 step process .The recovery catalog is stored in the default tablespace of the recovery catalog schema. SYS cannot be the owner of the recovery catalog.

1. Creating the Recovery Catalog Owner
2. Creating the Recovery Catalog
3. Registering the target database

1. Creating the Recovery Catalog Owner

1.1 Size of recovery catalog schema :

 Size of recovery catalog schema depends on

a) The number of databases monitored by the catalog.

b) The rate at which archived redo log generates in the target database

c) The number of backups for each target database

d) RMAN stored scripts stored in the catalog

1.2 Creating the Recovery Catalog Owner

Start by creating a database schema (usually called rman). Assign an appropriate tablespace to it and grant it the recovery_catalog_owner role. Look at this example:

% sqlplus '/ as sysdba'



2. Creating the Recovery Catalog

log in to rman and create the catalog schema.Look at this example:

In the below example " catdb " is the catalog database connection string. Before creating the recovery catalog make sure to have the tnsnames.ora entry for the catalog database in the target server and the listener must be up and running in the catalog database server.You must be able to connect to the catalog database from sqlplus from the target server.

% rman catalog rman/rman @ catadb


3. Registering the target database 

After making sure the recovery catalog database is open, connect RMAN to the target database and recovery catalog database and register the database . Make sure that your target database is either open or in Mount stage.Look at this example: 

% rman TARGET / CATALOG rman/rman @ catdb


RMAN creates rows in the catalog tables to contain information about the catalog database .Copy all the pertinent data from the controlfile into the catalog, synchronizing the catalog with the control file. You can register multiple target databases in a single recovery catalog, if they do not have duplicate DBIDs. RMAN uses the DBID to distinguish one database from another.

How to Upgrade recovery catalog Schema ?

When  you upgrade target database to the latest version you need to upgrade the RMAN catalog schema.Connect to RMAN from the target database so that you can use, the target database's RMAN executable. Look at the example :

% rman target / catalog rman/rman @ catdb
RMAN-06435: recovery catalog owner is rman
RMAN-06442: enter UPGRADE CATALOG command again to confirm catalog upgrade

Issuing 'upgrade catalog' will only upgrade the catalog schema to be compatible with the higher release of RMAN; it will not upgrade the catalog database in any way. You have to connect to recovery catalog database catdb and run "upgrade catalog" twice.

How to upgrade recovery catalog database ?

Upgrading the recovery catalog database is same as the any other database upgrade steps.Upgrading the catalog database do not upgrade the catalog database schema.

How to remove catalog ?

The "drop catalog;" command to remove an RMAN catalog. These commands need to be entered twice to confirm the operation. Look at the example :


How to unregister the target database from the recovery catalog ?

From 10G onwards, the process is simplified by introducing a new RMAN command to unregister the target database from the recovery catalog.Look at the example :


The command "unregister database " should be executed only at the RMAN prompt. This is a restriction to use this command.Also RMAN must be connected to the recovery catalog in which the target database is registered. ( Ref.  Note 252800.1 )

Prior to release 10G, in order to unregister the target database you need to execute the following statement in the recovery catalog database connected as recovery catalog schema owner.Look at the example :

% sqlplus rman/rman @catdb


To unregister a database from the recovery catalog prior to Oracle 10g  (Ref. Note 1058332.6).


How to backup of the Recovery Catalog ?

Recovery catalog database is just like any other database.This database backup need to be taken every time after the target database backup. You can take Physical backup or Logical backup of the catalog database.You can use RMAN for the backup of the recovery catalog database .

Few guideline for recovery catalog database

+ Run the recovery catalog database in ARCHIVELOG mode so that you can do point-in-time   recovery if needed.
+ Set the retention policy to a REDUNDANCY value greater than 1.
+ Do not use another recovery catalog as the repository for the backups.
+ Configure the control file autobackup feature to ON.

How to restore and Recover recovery catalog from Backup ?

Restoring and recovering the recovery catalog is much like restoring and recovering any other database

Compatibility of the Recovery Catalog

When you use RMAN with a recovery catalog in an environment where you have run past versions of the database, you can wind up with versions of the RMAN client, recovery catalog database, recovery catalog schema, and target database that all originated in different releases of the database.

Here is a note which gives detailed information about the compatibility matrix

Ref. Note 73431.1 RMAN Compatibility Matrix


How to identify recovery catalog schema version ?


The schema version of the recovery catalog is stored in the recovery catalog itself. The information is important in case you maintain multiple databases of different versions in your production system, and need to determine whether the catalog schema version is usable with a specific target database version.

To determine schema version of recovery catalog connect to catalog database from the recover catalog user and then query RCVER table. Look at the example :

% sqlplus rman/rman @catdb

SQL > SELECT * FROM rcver;  


If the table displays multiple rows, then the highest version in the RCVER table is the current catalog schema version. The table stores only the major version numbers and not the patch numbers. For example, assume that the rcver table displays the following rows:


1 comment:

Charles Stepp said...

Very nice. Just what what I was looking for in succinct format.