Thursday, April 16, 2009

Recovery Catalog Creation

Recovery Catalog Creation
CH # 17
What is recovery catalog?
Recovery catalog is external database which use to store RMAN
repository
What is RMAN repository?
RMAN repository is collection of target database which store
information about RMAN backup, recovery and maintenance.
When recovery catalog is not in used then where RMAN
repository stored?
When recovery catalog is not in used then RMAN repository store in
CONTROLFILE.
Where we create recovery catalog?
We have two option for it.
1. We can create recovery catalog on target database through create
separate tablespace for recovery catalog.
Or

2. We can create separate database for recovery catalog.
NOTE: if we have more than one database then separate database for
recovery catalog is recommended instead of separate tablespace.
How recovery catalog store information about RMAN
repository?
After creation of recovery catalog we have to manually register each
target database to recovery catalog.
Should we need to take backup of recovery catalog?
Yes, We must take backup of recovery catalog because recovery
catalog store most important information about RMAN backup,
recovery and RMAN configuration if we lost recovery catalog then we
can’t get those information so it is always recommended to take
recovery catalog backup.
How take recovery catalog backup?
1. If recovery catalog created as separate tablespace on target
database
Then just export recovery catalog tablespace and store in backup
drive.
2. If recovery catalog created as separate database.
Then we can use any backup method which we use for target database
for instance we can use user managed backup or we can also use
RMAN method.
Is there any view for query information about recovery
catalog?
Yes, actually for recovery catalog we need to create separate user.
And after user and recovery catalog creation there is some view
created in recovery catalog users with RC_ prefix. For instance:
RC_DATABASE
How to configure recovery catalog for target database?
There are three steps for recovery catalog configuration.
1. Configure the database that will content the recovery catalog,
2. Create owner for recovery catalog
3. Create recovery catalog

SQL> conn sys/oracle as sysdba
Connected.
SQL> create tablespace CATDB
2 datafile 'c:\oracle\catdb01.dbf' size 80m;
Tablespace created.
NOTE: Here I am create separate tablespace for recovery catalog on
target database.
SQL>conn sys/oracle as sysdba
Connected.
SQL> create user CATDB
2 identified by CATDB
3 default tablespace CATDB;
NOTE: Owner for recovery catalog
SQL> grant connect,resource to catdb;
Grant succeeded.
SQL> grant recovery_catalog_owner to CATDB;
Grant succeeded.
NOTE: 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.
C:\>rman
Recovery Manager: Release 10.1.0.5.0 - Production
Copyright (c) 1995, 2004, Oracle. All rights reserved.
RMAN> connect catalog catdb/catdb
connected to recovery catalog database
recovery catalog is not installed

RMAN> create catalog tablespace CATDB;
recovery catalog created
NOTE: now recovery catalog is created.
SQL> conn catdb/catdb
Connected.
SQL> select table_name from user_tables where rownum =1;
TABLE_NAME
------------------------------
RCVER
NOTE: after recovery catalog creation we can check all recovery
catalog views is created in recovery catalog owner.
What we do after create recovery catalog?
Now just register target database to recovery catalog and store RMAN
repository in recovery catalog.
C:\>rman target sys/oracle catalog catdb/catdb
connected to target database: DEV (DBID=3718891706)
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
Viewing the Recovery Catalog

1- RC_DATABASE (List of Registered database with Recovery Catalog)
2- RC_DATAFILE
3- RC_STORED_SCRIPT
4- RC_STORED_SCRIPT_LINE (display that what is inside the script)
5- RC_TABLESPACE
Just connect with user CATDB and perform the following queries
SQL> desc RC_Database
SQL>Desc RC_Datafile
Etc..
Stored Script in Recovery catalog
RMAN> Create script abc {
Backup database;}
Execute script
RMAN> Run {
Execute script abc;}
Replace Script
RMAN> Replace script abc
Backup database
Filesperset 2;}
Delete Script
RMAN> Delete script abc;
Print Script on screen
RMAN> Print script abc

No comments: