Pages

Friday, April 19, 2013

How to create the recovery catalog

To simulate other RMAN scenarios I need to create a recovery catalog.
This post so will be related on the basic steps to create the user account managing the recovery catalog and the creation of the recovery catalog itself.

The first step is to create the recovery catalog user account.
I prefer to assign a default tablespace to that user account. The database containig the recovery catalog is RCAT.
[oracle@vsi08devpom ~]$ export ORACLE_SID=RCAT
[oracle@vsi08devpom ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 18 15:13:54 2013

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> create tablespace RECOVERY_CATALOG datafile '/opt/app/oracle/oradata/RCAT/recovery_catalog01.dbf' size 15M autoextend on next 15M MAXSIZE 300M;

Tablespace created.
Now it's possible to create the user:
SQL> create user rman identified by rman
    temporary tablespace TEMP
    default tablespace RECOVERY_CATALOG;

User created.
I gave to rman user an unlimited quota to its default tablespace:
SQL> alter user rman quota unlimited on RECOVERY_CATALOG;

User altered.
Only two privileges are required to be granted to rman user:
SQL> grant create session, recovery_catalog_owner to rman;

Grant succeeded.
It's now possible to create the recovery catalog on RCAT database. Use the RMAN client and the catalog connection to specify you want to use a recovery catalog database:
[oracle@vsi08devpom ~]$ export ORACLE_SID=RCAT
[oracle@vsi08devpom ~]$ export NLS_DATE_FORMAT='DD-MM-RRRR HH24:MI:SS'
[oracle@vsi08devpom ~]$ rman catalog rman/rman

Recovery Manager: Release 11.2.0.1.0 - Production on Thu Apr 18 15:33:07 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to recovery catalog database
To create the recovery catalog objects inside the rman user schema you simply have to specify the create catalog command:
RMAN> create catalog;

recovery catalog created
The latest step is to register your database (in my case is PROD) in the recovery catalog.
[oracle@vsi08devpom ~]$ export ORACLE_SID=PROD
[oracle@vsi08devpom ~]$ export NLS_DATE_FORMAT='DD-MM-RRRR HH24:MI:SS'
[oracle@vsi08devpom ~]$ rman target / catalog rman/rman@RCAT

Recovery Manager: Release 11.2.0.1.0 - Production on Fri Apr 19 11:33:25 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PROD (DBID=223010867)
connected to recovery catalog database
Once you are connected both with the target PROD database and with RCAT recovery catalog database you can issue the register database command.
RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
Use the following command to show the registered databases on the recovery catalog:
RMAN> list db_unique_name all;


List of Databases
DB Key  DB Name  DB ID            Database Role    Db_unique_name
------- ------- ----------------- ---------------  ------------------
2       PROD     223010867        PRIMARY          PROD
That's all.