RMAN Cronjob and ftp backup scripts

RMAN

———————————-ftp.backup.script.sh—————————————————-

!/bin/sh

lftp -e “mirror -R /Backup /Backup” -u oracle,oracle 192.168.54.20

———————————-rman_incrementalbkp_script.sh———————————

run {
allocate channel ch1 type disk format ‘/Data/Backup/INCBKP_%d_set%s_piece%p_%T_%U_DBID%I’;
BACKUP AS COMPRESSED BACKUPSET incremental level 1 database ;
BACKUP AS COMPRESSED BACKUPSET archivelog all FORMAT ‘/Data/Backup/ARCH_%d_set%s_piece%p_%T_%U_DBID%I’;
BACKUP AS COMPRESSED BACKUPSET spfile format ‘/Data/Backup/SPFILE_%d_set%s_piece%p_%T_%U_DBID%I’;
BACKUP AS COMPRESSED BACKUPSET CURRENT CONTROLFILE FORMAT ‘/Data/Backup/CTLFILE_%d_%u_%s_%T_DBID%I’;
release channel ch1;

——————————————-rman_maininc.sh————————————————————-

ORACLE_HOSTNAME=PC0102-ORA01
export ORACLE_HOSTNAME
ORACLE_UNQNAME=test
export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle
export ORACLE_BASE
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_HOME
ORACLE_SID=test1
export ORACLE_SID

/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target=/ @/home/oracle/rman_incrementalbkp_script.sh

Where ORACLE_HOSTNAME is your machine hostname and ORACLE_UNQNAME and ORACLE_SID is the SID of the instance you need to backup.

———————————————–rman_cumulativebkp_script.sh———————————————-

run {
allocate channel ch1 type disk format ‘/Data/Backup/CUMBKP_%d_set%s_piece%p_%T_%U_DBID%I’;
BACKUP AS COMPRESSED BACKUPSET incremental level 1 cumulative database ;
BACKUP AS COMPRESSED BACKUPSET archivelog all FORMAT ‘/Data/Backup/ARCH_%d_set%s_piece%p_%T_%U_DBID%I’;
BACKUP AS COMPRESSED BACKUPSET spfile format ‘/Data/Backup/SPFILE_%d_set%s_piece%p_%T_%U_DBID%I’;
BACKUP AS COMPRESSED BACKUPSET CURRENT CONTROLFILE FORMAT ‘/Data/Backup/CTLFILE_%d_%u_%s_%T_DBID%I’;
release channel ch1;
}

———————————————rman_maincum.sh——————————————-

ORACLE_HOSTNAME=TEST01
export ORACLE_HOSTNAME
ORACLE_UNQNAME=TEST
export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle
export ORACLE_BASE
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_HOME
ORACLE_SID=TEST1
export ORACLE_SID

/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target=/ @/home/oracle/rman_cumulativebkp_script.sh

Where ORACLE_HOSTNAME is your machine hostname and ORACLE_UNQNAME and ORACLE_SID is the SID of the instance you need to backup.

———————————————rman_fullbkp_script.sh————————————

run {
allocate channel ch1 type disk format ‘/Data/Backup/FULLBKP_%d_set%s_piece%p_%T_%U_DBID%I’;
BACKUP AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 0 DATABASE;
BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL FORMAT ‘/Data/Backup/ARCH_%d_set%s_piece%p_%T_%U_DBID%I’ DELETE INPUT;
BACKUP AS COMPRESSED BACKUPSET spfile format ‘/Data/Backup/SPFILE_%d_set%s_piece%p_%T_%U_DBID%I’;
BACKUP AS COMPRESSED BACKUPSET CURRENT CONTROLFILE FORMAT ‘/Data/Backup/CTLFILE_%d_%u_%s_%T_DBID%I’;
release channel ch1;
}

————————————————rman_mainfull.sh—————————————–

ORACLE_HOSTNAME=PC0102-ORA01
export ORACLE_HOSTNAME
ORACLE_UNQNAME=dyaxprod
export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle
export ORACLE_BASE
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_HOME
ORACLE_SID=dyaxprod1
export ORACLE_SID

/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target=/ @/home/oracle/rman_fullbkp_script.sh

Where ORACLE_HOSTNAME is your machine hostname and ORACLE_UNQNAME and ORACLE_SID is the SID of the instance you need to backup.