Best Backup script

cat > run.sh

!/bin/sh

. /home/oradev/DEVCDB_erpr12.env
DATE=date +%m%d%y%H%M

find /ub1002/PROD/Backups/PROD_bu_* -mtime +0 -exec rm -f {} \;

find /ub1002/PROD/Backups/PROD_bu_* -ctime +1 -exec rm -f {} \;

$ ORACLE_HOME/bin/rman target / log=/home/oradev/scripts/backup_DEV_$ DATE.log @/home/oradev/scripts/cdbdb.rman

cat > /home/oradev/scripts/cdbdb.rman

run {
allocate channel d1 type disk;
allocate channel d2 type disk;
allocate channel d3 type disk;
allocate channel d4 type disk;
allocate channel d5 type disk;
allocate channel d6 type disk;
backup AS COMPRESSED BACKUPSET format ‘/u02/oracle/DEV/backup/DEV_bu_db_%d_t%t_s%s_p%p’ database;
sql ‘alter system archive log current’;
sql ‘alter system archive log current’;
sql ‘alter system archive log current’;
sql ‘alter system archive log current’;
sql ‘alter system archive log current’;
backup AS COMPRESSED BACKUPSET format ‘/u02/oracle/DEV/backup/DEV_bu_al_t%t_s%s_p%p’ archivelog all skip inaccessible delete input;
backup format ‘/u02/oracle/DEV/backup/DEV_control%U’ current controlfile;
crosscheck archivelog all;
release channel d1;
release channel d2;
release channel d3;
release channel d4;
release channel d5;
release channel d6;
}

Blog for DBA, RAC, EBS DBA

Author: admin

Leave a Reply

Your email address will not be published. Required fields are marked *