Pages

Saturday 14 May 2016

Full Database Backup script Through Rman

Execute Rman script:
------------------------

today=$(date +'%m-%d-%C%y;%H:%M')
echo $today
ORACLE_SID=testdb
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH:.
export ORACLE_HOME PATH ORACLE_SID
now=$(date +"%d-%m-%Y")
mkdir /u01/Rman_Backup/FULLDB_testdb_$now
export DAY='date +%d'
export NUM='expr $DAY / 7'

$ORACLE_HOME/bin/rman << EOF
connect target /
run {
allocate channel ch00 type disk;
allocate channel ch01 type disk;
#allocate channel ch02 type disk;
#allocate channel ch03 type disk;
#allocate channel ch04 type disk;
#allocate channel ch05 type disk;
#allocate channel ch06 type disk;
set command id to 'hot_database_backup';
backup
as compressed backupset
incremental level = 0
check logical
database tag='WEEKLY_BACKUP'
FORMAT '/u01/Rman_Backup/FULLDB_testdb_$now/testdb_%c_%d_S_%s_P_%p_T_%t' ;
backup
format '/u01/Rman_Backup/FULLDB_testdb_$now/c_%d_%Y%M%D.%s.%p.%t'
current controlfile;
release channel ch00;
release channel ch01;
#release channel ch02;
#release channel ch03;
#release channel ch04;
#release channel ch05;
#release channel ch06;
}
delete noprompt obsolete ;
list backup;
crosscheck backup;
delete noprompt expired backup;
delete noprompt expired copy;
delete noprompt expired archivelog all;
EOF
today=$(date +'%m-%d-%C%y;%H:%M')
echo $today

No comments:

Post a Comment