Monday 6 October 2014

RMAN Daily Full Backup 11.2.0.3



RMAN Daily Full Backup:

Base Directory = /backup/PROD
This is the location where Backup script placed, Backup files and logs will create.
Backup Script: rman.sh




#!/bin/bash
. /u01/oraprd/PROD/db/tech_st/11.2.0/PROD_db-prod.env
DATE=`date +"%d_%m_%y_%a_%H_%M"`
cd /backup/PROD/logs
mkdir $DATE
cd /backup/PROD/backup/
mkdir $DATE
cd
cd /u01/oraprd/PROD/db/tech_st/11.2.0/bin
./rman  target 'system/manager' log=/backup/PROD/logs/$DATE/rman_$DATE.log << EOF
crosscheck archivelog all;
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
run {
    allocate channel C1 type disk;
    allocate channel C2 type disk;
    backup AS COMPRESSED BACKUPSET tag whole_database_open format '/backup/PROD/backup/$DATE/PROD_db_%T_%t_s%s_p%p.bak' (DATABASE);
    sql 'alter system archive log current';
    sql 'alter system archive log current';
    change archivelog all validate;
    BACKUP format '/backup/PROD/backup/$DATE/PROD_AR_%d_%s_%p.bak' TAG 'Prod_Arch_backup' ARCHIVELOG ALL NOT BACKED UP DELETE ALL INPUT;
    backup current controlfile format '/backup/PROD/backup/$DATE/cntc_%T_%t_s%s_p%p';
    release channel C1;
    release channel C2;
}
EOF
mv -f /backup/PROD/logs/$DATE/rman_$DATE.log /backup/PROD/logs/$DATE/rman_backup_$DATE.log
#exit;

 This Script will create Folders with Sysdate in backup location and log location, to easily understand backup date and logfile dates.

For every run of backup script it will create a directory Named with backup date and time
(DD-MM-YY-DAY-HH-MM) under backup location and log location.

Example:  06_10_14_Mon_01_00 
Data Files, Archive log files and control file backup sets will be create under backup/PROD/backup/
Daily Backup Logfiles will be created under /backup/PROD/logs/

RMAN Backup Schedule:
Scheduled RMAN Backup using Crontab to run Everyday 01:00am.

Monitor Backup:
Check the RMAN Backup log file for Backup status:
Check the logfile for Backup complete status as well as any errors while backup like RMAN-, ORA-

Sample Error Log file:
Check the log file for status of backup completion. And log file shoul not contain any errors like RMAN- , ORA- .
It should be like: Finished backup, and released channel: C1

Backups check:
Goto backup location of current date:
Check the backups available for Prod –DB,Archive, and Controlfile.

[oraprd@db-prod backup]$ cd 06_10_14_Mon_01_00/
[oraprd@db-prod 06_10_14_Mon_01_00]$ ls -lrt
total 6660796
-rw-r----- 1 oraprd dba 2524495872 Oct  6 01:10 PROD_db_20141006_860202005_s42_p1.bak
-rw-r----- 1 oraprd dba 2067849216 Oct  6 01:10 PROD_db_20141006_860202005_s41_p1.bak
-rw-r----- 1 oraprd dba 2141388800 Oct  6 01:19 PROD_db_20141006_860202640_s43_p1.bak
-rw-r----- 1 oraprd dba             8704 Oct  6 01:19 PROD_AR_PROD_46_1.bak
-rw-r----- 1 oraprd dba     45325824 Oct  6 01:19 PROD_AR_PROD_45_1.bak
-rw-r----- 1 oraprd dba     34897920 Oct  6 01:19 cntc_20141006_860203189_s47_p1

PROD_db_20141006_860202005_s42_p1.bak
in this PROD_db denotes PROD Instance Data files Backup-set.

PROD_AR_PROD_46_1.bak
In This PROD-AR denotes Prod Archive Backup-set.

cntc_20141006_860203189_s47_p1
In this cntc denotes Contorlfile Backup-set


References

Oracle Database Backup and Recovery User's Guide 11g Release 1 (11.1)
B28270-03

Oracle® Database Backup and Recovery User's Guide 11g Release 2 (11.2)
E10642-06

No comments:

Post a Comment