Wednesday, May 7, 2008

How to create recovery catalog and use it

Recovery Catalog Concepts:

Recovery catalog holds the RMAN repository information(i.e backup information) in a separate database schema in addition to control files. Though you can use target database as a recovery catalog database(The database where recovery catalog resides) but you will not do that because recovery catalog must be protected in the event of the loss of target database.

Before proceed it is good to understand about recovery catalog that recovery catalog is nothing but a schema that owns a list of tables. SYS user can't be owner of recovery catalog.
How to Create Recovery Catalog:
Creating a recovery catalog is a three steps process.They are,

A)Configure Recovery Catalog Database.
B)Create the Recovery Catalog owner.
C)Create Recovery Catalog itself.

A)Configure Recovery Catalog Database:
1)Choose any database to select as recovery catalog database rather than target database(where you will perform backup).

2)Create a tablespace where recovery catalog information will be populated.
SQL> SELECT NAME,DBID FROM V$DATABASE;
NAME DBID
--------- ----------
ARJU 2869417476

SQL> CREATE TABLESPACE catalog_tbs DATAFILE '/oradata2/catalog01.dbf' SIZE 100M;
Tablespace created.

B)Create the Recovery Catalog owner.

1)Create a user in the recovery catalog database who actually owns the recovery catalog schema. Also assign default tablespace catalog_tbs to this user.

SQL> SELECT NAME,DBID FROM V$DATABASE;

NAME DBID
--------- ----------
ARJU 2869417476

SQL> CREATE USER catalog_user IDENTIFIED BY catalog_pwd TEMPORARY TABLESPACE TEMP DEFAULT TABLESPACE catalog_tbs QUOTA UNLIMITED ON catalog_tbs;

User created.

2)Grant the RECOVERY_CATALOG_OWNER role to the schema owner. This role provides the user with all privileges required to maintain and query the recovery catalog.

SQL> GRANT RECOVERY_CATALOG_OWNER TO catalog_user;
Grant succeeded.


C)Create Recovery Catalog itself:
At this stage you have only a tablespace and a user in recovery catalog database. There is no objects in the recovery catalog schema.
SQL> SELECT NAME,DBID FROM V$DATABASE;
NAME DBID
--------- ----------
ARJU 2869417476

SQL> conn catalog_user/catalog_pwd
Connected.

SQL> select * from user_tables;
no rows selected

Now you have to populate tables in the schema. To do this,

1)Through RMAN connect to the database that will contain the catalog as the catalog owner.

SQL> !rman CATALOG catalog_user/catalog_pwd

Recovery Manager: Release 10.2.0.1.0 - Production on Wed May 7 05:51:44 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to recovery catalog database


2)Run the CREATE CATALOG command to create the catalog.

RMAN>CREATE CATALOG;

recovery catalog created

You can also create catalog in other tablespace like USERS if you specify that just like below,

RMAN>CREATE CATALOG TABLESPACE USERS;


In our example we created catalog tablespace catalog_tbs so our command will be,
RMAN>CREATE CATALOG TABLESPACE catalog_tbs;

3)Check the recovery catalog tables, objects, view, package etc.

SQL> SELECT COUNT(*) FROM USER_OBJECTS;
COUNT(*)
----------
195


Now the next step is how to use it. It is discussed in How to Use Recovery Catalog

Related Documents:
How to Use Recovery Catalog

1 comment:

  1. Hiya Arju,

    The recovery Catalog tablespace you have created was "catalog_tbs"
    and on RMAN prompt you have created

    RMAN>CREATE CATALOG TABLESPACE USERS;

    DreamzZ!!!

    ReplyDelete