[oraprod@taw-ora-db scripts]$ cat /home/oraprod/scripts/rman_daily_full.sh
# *====================================================================================+
# | Author - Tahaluf AlEmaraat - Mohammed Al-Masri
# | |
# +====================================================================================+
# |
# | DESCRIPTION
# | Take rman full backup
# | PLATFORM
# | Linux/Solaris/HP-UX
# +===========================================================================+
#!/bin/bash
. ~/.bash_profile
fullBackup () {
rman log=/backup/CIRC/backups/logs/RMANDailyFull.log << EOF
connect target /
set echo on;
configure controlfile autobackup on;
run
{
ALLOCATE CHANNEL c1 DEVICE TYPE disk ;
ALLOCATE CHANNEL c2 DEVICE TYPE disk ;
backup AS COMPRESSED BACKUPSET full database tag FullBackup format '/backup/CIRC/backups/%d_%T_%s_%p_FULL.BKP' ;
sql 'alter system archive log current';
backup tag ARCHIVEBackup format '/backup/CIRC/backups/%d_%T_%s_%p_ARCHIVE.BKP' archivelog all delete all input ;
backup tag CONTROLBackup current controlfile format '/backup/CIRC/backups/%d_%T_%s_%p_CONTROL.BKP';
release channel c1;
release channel c2;
}
configure backup optimization clear;
configure controlfile autobackup clear;
#sql 'alter system archive log current';
exit
EOF
}
# Main
fullBackup
export log_name="RMANDailyFull_$(date +%Y%m%d_%H%M%S).log"
mv /backup/CIRC/backups/logs/RMANDailyFull.log /backup/CIRC/backups/logs/$log_name
[oraprod@taw-ora-db scripts]$ crontab -l
0 20 * * * /usr/bin/find /backup/FULL_BACKUP/ -name "*.BKP" -type f -mtime +3 -exec rm -f {} \;
* 22 * * * /home/oracle/scripts/rman_daily_full.sh
~
~
# *====================================================================================+
# | Author - Tahaluf AlEmaraat - Mohammed Al-Masri
# | |
# +====================================================================================+
# |
# | DESCRIPTION
# | Take rman full backup
# | PLATFORM
# | Linux/Solaris/HP-UX
# +===========================================================================+
#!/bin/bash
. ~/.bash_profile
fullBackup () {
rman log=/backup/CIRC/backups/logs/RMANDailyFull.log << EOF
connect target /
set echo on;
configure controlfile autobackup on;
run
{
ALLOCATE CHANNEL c1 DEVICE TYPE disk ;
ALLOCATE CHANNEL c2 DEVICE TYPE disk ;
backup AS COMPRESSED BACKUPSET full database tag FullBackup format '/backup/CIRC/backups/%d_%T_%s_%p_FULL.BKP' ;
sql 'alter system archive log current';
backup tag ARCHIVEBackup format '/backup/CIRC/backups/%d_%T_%s_%p_ARCHIVE.BKP' archivelog all delete all input ;
backup tag CONTROLBackup current controlfile format '/backup/CIRC/backups/%d_%T_%s_%p_CONTROL.BKP';
release channel c1;
release channel c2;
}
configure backup optimization clear;
configure controlfile autobackup clear;
#sql 'alter system archive log current';
exit
EOF
}
# Main
fullBackup
export log_name="RMANDailyFull_$(date +%Y%m%d_%H%M%S).log"
mv /backup/CIRC/backups/logs/RMANDailyFull.log /backup/CIRC/backups/logs/$log_name
[oraprod@taw-ora-db scripts]$ crontab -l
0 20 * * * /usr/bin/find /backup/FULL_BACKUP/ -name "*.BKP" -type f -mtime +3 -exec rm -f {} \;
* 22 * * * /home/oracle/scripts/rman_daily_full.sh
~
~
No comments:
Post a Comment