Monday, July 25, 2011

RMAN Recovery Catalog Database Creation and Configuration

Hi,
RMAN Recovery Catalog is an excellent way of keeping our backup safe.Since backup is the medicine of Database in case of failure or Data loss,so we don't want to keep the medicine and poison in the same bottle(which will be the case when target Database 'Controlfile' will be using for keeping the information of Backup.If the 'Controlfile' is corrupted or deleted(usually it is multiplexed),but still 'Controlfile' will be acting as poison and medicine.Hence Best option will be to use the 'Recovery Catalog'(Other Database to keep the RMAN metadata) where our backup can be safe.

Below are some steps for Creating and Configuring Recovery Catalog for our Database which might be production,test or Development:

Step 1:Create a new database for RMAN – Recovery catalog database->'CATDB' Database created using dbca.

Note: We can create a small database with minimal sizes of tablespaces and others, and we can name the database as CATDB for naming convention and to avoid the confusion between our production and rman databases.

Step 2:Create a new tablespace in the new database (CATDB)

$ sqlplus /nolog

CONNECT SYS/welcome@catdb AS SYSDBA;

CREATE TABLESPACE rman
DATAFILE 'D:\rafi\catdb\rman\rman01.dbf' size 200m;


Step 3:Create the Recovery Catalog Owner in the new database (CATDB)

CREATE USER rman IDENTIFIED BY rman
DEFAULT TABLESPACE rman
QUOTA UNLIMITED ON rman;

Step 4:Grant the necessary privileges to the schema owner

SQL> GRANT recovery_catalog_owner TO rman;

Here the role "RECOVERY_CATALOG_OWNER" provides the user with all privileges required to maintain and query the recovery catalog.RECOVERY_CATALOG_OWNER role has the CREATE_SESSION privileges so need to grant separately.

Step 5:Creating the Recovery Catalog

Connect to the database which will contain the catalog as the catalog owner.
For example:'rman' user is catalog owner in our example.

On Linux(UNIX):
------------------

Run the 'CREATE CATALOG' command to create the catalog

$ rman target / catalog rman/rman@catdb
RMAN> CREATE CATALOG;

recovery catalog created

On Windows:
--------------------


C:\Windows\system32>rman target / catalog rman/rman@catdb

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Jun 21 00:44:02 2011

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

connected to recovery catalog database

RMAN> CREATE CATALOG;

recovery catalog created


Step 6:Registering a Database in the Recovery Catalog
Connect to the target database and recovery catalog database.

$ export ORACLE_SID=ORCL
$ rman target / catalog rman/rman@catdb

Recovery Manager: Release 11.2.0.1.0 - Production on Sun July 1 14:25:30 2007
Copyright (c) 1982, 2010, Oracle. All rights reserved.
connected to target database: ORCL (DBID=3677528376)
connected to recovery catalog database

windows:
-------------
C:\Windows\system32>set ORACLE_SID=ORCL

C:\Windows\system32> rman target / catalog rman/rman@catdb

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Jun 21 01:03:19 2011

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

connected to target database: ORCL (DBID=1280115002)
connected to recovery catalog database

Step 7:Register and Verify after connection

RMAN> REGISTER DATABASE;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

On Windows (OR) Linux Environment:
-------------------------------


RMAN> REGISTER DATABASE;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

Register the target Database using 'REGISTER DATABASE' command as seen above.

Make sure that the registration is successful by running REPORT SCHEMA:

RMAN> REPORT SCHEMA;

Report of database schema

RMAN> REPORT SCHEMA;

Report of database schema for database with db_unique_name ORCL

List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 690 SYSTEM YES D:\APP\RAFIALVI\ORADATA\ORCL\SYSTEM01.DBF
2 570 SYSAUX NO D:\APP\RAFIALVI\ORADATA\ORCL\SYSAUX01.DBF
3 55 UNDOTBS1 YES D:\APP\RAFIALVI\ORADATA\ORCL\UNDOTBS01.DBF
4 6144 USERS NO D:\APP\RAFIALVI\ORADATA\ORCL\USERS01.DBF
5 100 EXAMPLE NO D:\APP\RAFIALVI\ORADATA\ORCL\EXAMPLE01.DBF

List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 20 TEMP 32767 D:\APP\RAFIALVI\ORADATA\ORCL\TEMP01.DBF

Note:

In Windows:
---------------
For Connecting to recovery catalog Database 'CATDB' with rman for Target Database 'ORCL':
C:\Windows\system32>set ORACLE_SID=ORCL
C:\Windows\system32>rman target / CATALOG rman/rman@CATDB

In Linux:
-----------------
For Connecting to recovery catalog Database 'CATDB' with rman for Target Database 'ORCL':
$export ORACLE_SID=ORCL
$rman target / CATALOG rman/rman@CATDB

Rest all steps are prety much similar in both environment.....

Hope it helps.

Best regards,

Rafi.

No comments:

Post a Comment