Saturday 20 June 2015

                         RMAN Full Database backup script



This document describes how to take full database backup using RMAN(Recovery Manager).
First will create rmanfullbackup.sh file/script to run from OS level. Inturn this script
will call another script/CMDfile named rmanfullbk.rmn to take full database backup using RMAN.



vi rmanfullbackup.sh

#!/bin/sh
ORACLE_SID=testinguatdb; export ORACLE_SID
ORACLE_HOME=/u01/app/11.2.0/dbhome_1;
export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin export PATH
DD=`date +%d%h`
LNAME=/u01/createDB/scripts/${DD}rman_backup.log
###############DELETE BACKUP ################
#rm /ora_backup/Rman_Backup_DB_File/DB_RMAN_PLI*
#rm /ora_backup/Rman_Backup_DB_Arch/DB_ARCH_PLI*


rman target sys/password nocatalog cmdfile '/u01/createDB/scripts/rmanfullbk.rmn' log $LNAME


vi rmanfullbk.rmn

crosscheck archivelog all;
crosscheck backup;
delete expired backup;
delete force noprompt expired backup;
delete expired archivelog all;


run

{

allocate channel c1 device type disk format '/u01/createDB/DB_RMAN_%d_%u_%s_%p';

allocate channel c2 device type disk format '/u01/createDB/DB_RMAN_%d_%u_%s_%p';

allocate channel c3 device type disk format '/u01/createDB/DB_RMAN_%d_%u_%s_%p';

allocate channel c4 device type disk format '/u01/createDB/DB_RMAN_%d_%u_%s_%p';

BACKUP database include current controlfile;

release channel c1;

release channel c2;

release channel c3;

release channel c4;

}

run

{

allocate channel c1 device type disk format '/u01/createDB/DB_ARCH_%d_%u_%s_arc';

allocate channel c2 device type disk format '/u01/createDB/DB_ARCH_%d_%u_%s_arc';

allocate channel c3 device type disk format '/u01/createDB/DB_ARCH_%d_%u_%s_arc';

allocate channel c4 device type disk format '/u01/createDB/DB_ARCH_%d_%u_%s_arc';

sql 'alter system switch logfile';

sql 'alter system archive log current';

BACKUP archivelog all ;


#delete input;

release channel c1;

release channel c2;

release channel c3;

release channel c4;

}
crosscheck archivelog all;

No comments:

Post a Comment