Search

Join this Blog for direct reference of any post into your inbox. To join just click on "Join this Site" under "Follower" then Login with your Email.*** DECLARATION: I Maintain this Blog for Helping Myself While at Work and Welcome any body Needing Help!!!.*** CAUTION: Using any of the script from this Blog may contain at Own Risk. These scripts May or May not have been Tested.***

Thursday, 15 March 2012

Managing RMAN Catalog on Windows 2003 Env.

The recovery catalog is an Oracle database and associated objects in a schema that are created to manage RMAN backups. Although the recovery catalog is not required to use RMAN, some of the backup/recovery functions are not available without it being set up correctly. Generally, to set up a catalog, you identify the database in which the catalog will exist. This database should be separate from other Oracle databases. Then you will create the recovery catalog, create any backup scripts and begin to use the recovery catalog.
So, what are the benefits of using the recovery catalog? RMAN does not require the recovery catalog in most cases. Without the recovery catalog in place however, these RMAN features are not available:
– Tablespace point-in-time recovery
– Stored scripts
– Recovery when the control file is lost or damaged
The bottom line is that Oracle strongly recommends that you use the recovery catalog.
Once you have set up the recovery catalog, you use the RMAN executable in concert with RMAN manual commands or stored scripts to back up, recover, and report on backups.
Steps: To Configure RMAN
‎1.‎ Create database (RMAN)‎
‎2.‎ Create Table space (RTBS)‎
‎3.‎ Create a USER (CATALOG)‎
‎4.‎ Grant Recovery_Catalog_owner to user.‎
‎5.‎ Create catalog.‎
‎6.‎ Register the target database.‎
‎7.‎ Parameter setup.‎
1. Create a Database Rman at the time of Oracle Installation on the new system.
2. Create a Tablespace RTBS and make it RMAN catalog storage.
SQL>create tablespace RTBS datafile 'D:\Oracle\Oradata\RMAN\RTBS01.dbf'‎  size 200m autoextend on;‎ 

3. Create Catalog user and assign the RTBS Tablespace as default storage.
Login as sysdba with rman database
sys/oracle@rman as sysdba
SQL>create user Catalog identified by Catalog 
Temporary tablespace TEMP
default tablespace RTBS
quota‎ unlimited on RTBS;‎
4. Grant Recovery Catalog to user 'CATALOG'
SQL>Grant connect, resource, recovery_catalog_owner to Catalog;‎
SQL>Exit
5. Create Catalog and Connect
CMD>RMAN
CMD>connect CATALOG catalog/catalog@rman
OR
CMD>RMAN CATALOG CATALOG/CATALOG@RMAN
Create catalog
OR
CREATE CATALOG TABLESPACE 'RTBS'‎
Exit
6. Register the Target database
CMD> rman target sys/oracle@orcl3 catalog catalog/catalog@rman
RMAN> STARTUP MOUNT;
rman>register database;
7. Rman Parameter Setup
rman>show all;
RMAN>‎ CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;
RMAN> CONFIGURE BACKUP OPTIMIZATION ON;
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;‎
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 
‎‎'H:\ORABACK\%F';
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT ‎‎'H:\ORABACK\%T_%U';‎
RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'H:\ORABACK\SNCFSADHAN.ORA';
8. Verify that the registration was successful by running REPORT SCHEMA:‎
RMAN> REPORT SCHEMA;‎
9. Cataloging Older Files in the Recovery Catalog
RMAN> CATALOG BACKUPPIECE ‘D:\BACKUP\RMAN\HOTBACKUP\ 20120126_FULL_DATABASE_ORCL3-829_1’;‎
RMAN> CATALOG DATAFILECOPY 'D:\BACKUP\RMAN\HOTBACKUP ‎‎\old_datafiles\01_01_2003\users01.dbf’;‎
RMAN> CATALOG ARCHIVELOG ‘D:\BACKUP\RMAN\HOTBACKUP/ ‎ARCH_ORCL3_LLN103R7_1_1’;‎
You can also catalog multiple backup files in a directory at once, using the 
CATALOG START ‎WITH command, as shown in this example:‎
RMAN> CATALOG START WITH 'D:\BACKUP\RMAN\HOTBACKUP';‎
Backing Up and Recovering the Recovery Catalog
CMD> RMAN TARGET CATALOG/CATALOG@RMAN NOCATALOG
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
Guidelines RMAN backup strategy for the recovery catalog database:‎
1. Run the recovery catalog database in ARCHIVELOG mode so that you can do point-in-‎time recovery if needed.‎
2. Set the retention policy to a REDUNDANCY value greater than 1.‎
3. Back up the database onto two separate media (for example, disk and tape).‎
4. Run BACKUP DATABASE PLUS ARCHIVELOG at regular intervals, to a media manager ‎if available, or just to disk.‎
5. Do not use another recovery catalog as the repository for the backups.‎
6. Configure the control file autobackup feature to ON.‎
Restoring and Recovering the Recovery Catalog from Backup
Restoring and recovering the recovery catalog is much like restoring and recovering any other ‎database, if you backed it up with RMAN. You can restore the control file and SPFILE for the ‎recovery catalog database from an autobackup, then restore and perform complete recovery on ‎the rest of the database. ‎
Exporting and Importing the Recovery Catalog
CMD> exp catalog/catalog@rman FILE=cat.dmp OWNER=catalog
‎1. Create a new user in another database or another server then import:‎
CMD>imp USERID=catalog1/catalog1@rman1 FILE=cat.dmp FROMUSER=catalog ‎TOUSER=catalog1 ‎
‎2. Then Use the import catalog data to restore and recovery the target database.‎
Unregister a database from RMAN catalog
First we start up RMAN with a connection to the catalog and the target, making a note of the DBID in the banner:
C:\>rman target sys/oracle@orcl3 catalog catalog/catalog@rman
connected to target database: Orcl3 (DBID=691421794)
connected to recovery catalog database
Note the DBID from here.
Next we list and delete any backupsets recorded in the repository:
RMAN> LIST BACKUP SUMMARY;
RMAN> DELETE BACKUP DEVICE TYPE DISK;
Next we connect to the RMAN catalog owner using SQL*Plus and issue the following statement:
SQL> CONNECT catalog/catalog@rman
Connected.
SQL> SELECT db_key, db_id  FROM   db
 WHERE  db_id =  691421794;
    DB_KEY      DB_ID
    ---------- ----------
         1 691421794
The resulting key and id can then be used to unregister the database:
SQL> EXECUTE dbms_rcvcat.unregisterdatabase(1, 691421794);
PL/SQL procedure successfully completed.
Dropping the Recovery Catalog
To drop the recovery catalog schema:‎
‎1.‎ Use RMAN to connect to the target and recovery catalog databases.‎
‎CMD> rman TARGET sys/oracle@orcl3 CATALOG catalog/catalog@rman‎
‎2.‎ Issue the DROP CATALOG command twice to confirm:‎
DROP CATALOG;‎
recovery catalog owner is rman
enter DROP CATALOG command again to confirm catalog removal
‎DROP CATALOG;‎
Link to a simple script for Rman Catalog Backup: http://shahiddba.blogspot.com/2012/04/rman-catalog-backup-script.html

0 comments:

Post a Comment