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.***

Wednesday, 18 April 2012

Rman Catalog Backup Script

The way How to manage Rman Catalog Backup? I already posted on my earlier post: “ Managing Rman Catalog.” Now in this post I am going to share the script to manage catalog backup. There are two scripts one is for the purpose of backup and another one is used to copy the backup from one server to another server location.
The CATALOG_BACKUP.cmd having the target of Rman in Nocatalog mode and RCV file having the actual backup command.
Off course when use rman backup without recovery catalog RMAN uses control file to do its house keeping operation such as keeping track of ARCHIVE logs and BACKUP sets. In such configuration it's best to increase control_file_record_keep_time from it's default value of 7 days to whatever your backup retention policy. To increase control_file_record_keep_time see my 20th March 2012 post.

Consider the Rman parameter setting is configured permanently on root:
C:\>rman target sys/oracle@rman nocatalog

Recovery Manager: Release 9.2.0.1.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.
connected to target database: RMAN (DBID=1664586070)
using target database controlfile instead of recovery catalog
RMAN> show all;
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 5;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'D:\BACKUP_RMAN_
DB\Hotbackup\%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   'D:\BACKUP_RMAN_DB\Hotbackup\%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'D:\BACKUP_RMAN_DB\HOTBACKUP\SNCFRMAN.ORA';
RMAN>

By clicking on command scripts CATALOG_BACKUP.cmd we are able to take the backup of Catalog  RMAN database or we can schedule this script weekly after the weekly full backup of original server. This script will generate Full backup with Archivelog and Controlfile and spfile Backup.
The Batch file Rmanserver_Backup_copy.bat is used to copy the Backup from one server location to another server after every day backup.
It will copy the latest date file (today’s modified file) which is not available on the destination. If it will get same file will overwrite. The script will also write copy time information on log file in Copy_date_.txt after each copy.
Precaution: Timely check the required space on Rmanserver drive location and don’t forget to rename the backup logs before being overwritten.
CATALOG_BACKUP.cmd: Contents
D:\oracle\ora92\bin\RMAN TARGET SYS/oracle@rman NOCATALOG CMDFILE=D:\BACKUP_RMAN_DB\CATALOG_BACKUP.RCV LOG=D:\BACKUP_RMAN_DB\Logs\Catalog_BACKUP.LOG
CATALOG_BACKUP.RCV: Contents
# Backup  Full database and Archivelog all (with Current Redolog) and delete all archive input from drive.
allocate channel for delete type disk;
# Crosscheck and examine the backups with the Controlfile. If they are no longer on disk then delete that backup and release the space.
crosscheck backup;
delete expired backup;
# lists and delete that backups is not able to recover the database and release that space.
REPORT OBSOLETE;
Delete obsolete;
run {
allocate channel d1 type disk FORMAT "D:\BACKUP_RMAN_DB\Hotbackup\CATALOG_%T_FULL_%d-%s_%p.db";
allocate channel d2 type disk FORMAT "D:\BACKUP_RMAN_DB\Hotbackup\CATALOG_%T_FULL_%d-%s_%p.db";
allocate channel d3 type disk FORMAT "D:\BACKUP_RMAN_DB\Hotbackup\CATALOG_%T_FULL_%d-%s_%p.db";
sql 'alter system archive log current';
                backup
               
                                tag Catalog_Full_Rman
                                filesperset 10
                                format "D:\BACKUP_RMAN_DB\Hotbackup\CATALOG_%T_FULL_%d-%s_%p.db"
                                database archivelog all delete all input
                                ;
release channel d1;
release channel d2;
release channel d3;
}
# Reports which database files require backup because they have been affected by some NOLOGGING operation
REPORT UNRECOVERABLE;
# Reports which database files need to be backed up to meet a configured or specified retention policy
REPORT NEED BACKUP;
Rmanserver_Backup_copy.bat
set path=c:\WINDOWS\system32;
echo Copying started at %date% %time%>>Copy_date_.txt
xcopy \\192.00.01.02\d$\BACKUP_RMAN_DB\Hotbackup \\192.04.01.05\h\Rman_DBbackup /Y /a /d
echo Copying finished at %date% %time%>>Copy_date_.txt
echo Completed Successfully at %date% %time%>>Copy_date_.txt
echo --------------------------------------------------------------------------- >>Copy_date_.txt
@rem The script will copy all the newly generated date files if any file already existed it will Ignore that file. It will record each copy in Copy_date.txt

0 comments:

Post a Comment