HQ_顯示RMAN備份資訊及日誌

lusklusklusk發表於2016-11-09
vi /mesbk/scripts/backupLev0.sh
DATE=`date +%Y%m%d`
rman target/ cmdfile=/mesbk/scripts/rmanBackupLev0.rman msglog=/mesbk/log/rmanBackupLev0_$DATE.log

vi /mesbk/scripts/rmanBackupLev0.rman
run{
ALLOCATE CHANNEL ch1 TYPE disk;
BACKUP INCREMENTAL LEVEL 0 TAG 'DB0' DATABASE FORMAT '/mesbk/data/DB_0_%T_%s_%U' PLUS ARCHIVELOG  FORMAT '/mesbk/archivelog/ARCH_0_%T_%s' DELETE ALL INPUT;
RELEASE CHANNEL ch1;
CROSSCHECK BACKUP;
CROSSCHECK ARCHIVELOG ALL;
DELETE NOPROMPT EXPIRED BACKUP;
DELETE EXPIRED ARCHIVELOG ALL;
REPORT OBSOLETE;
DELETE NOPROMPT OBSOLETE;
}

vi /mesbk/scripts/backupLev0_log.sh
DATE=`date -d "-1 day" +%Y%m%d`
mail_list='XX@YY.COM'
cat /mesbk/log/rmanBackupLev0_$DATE.log|mailx -s "MDB 192.168.3.3 0級備份過程明細" $mail_list




vi /mesbk/scripts/backupLev1.sh
DATE=`date +%Y%m%d`
rman target/ cmdfile=/mesbk/scripts/rmanBackupLev1.rman msglog=/mesbk/log/rmanBackupLev1_$DATE.log

vi /mesbk/scripts/rmanBackupLev1.rman
run{
ALLOCATE CHANNEL ch1 TYPE disk;
BACKUP INCREMENTAL LEVEL 1 TAG 'DB1' DATABASE FORMAT '/mesbk/data/DB_1_%T_%s_%U' PLUS ARCHIVELOG  FORMAT '/mesbk/archivelog/ARCH_1_%T_%s' DELETE ALL INPUT;
RELEASE CHANNEL ch1;
CROSSCHECK BACKUP;
CROSSCHECK ARCHIVELOG ALL;
DELETE NOPROMPT EXPIRED BACKUP;
DELETE EXPIRED ARCHIVELOG ALL;
REPORT OBSOLETE;
DELETE NOPROMPT OBSOLETE;
}

vi /mesbk/scripts/backupLev1_log.sh
DATE=`date -d "-1 day" +%Y%m%d`
mail_list='XX@YY.COM'
cat /mesbk/log/rmanBackupLev1_$DATE.log|mailx -s "MDB 192.168.3.3 1級備份過程明細" $mail_list


rman target /
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/mesbk/controlfile/CNTRL_%T%F';


備份檔案資訊
/mesbk/data
/mesbk/archivelog
/mesbk/controlfile




[root@mesdb log]# crontab -l
0  21 * * 6 su - oracle -c "/mesbk/scripts/backupLev0.sh"
30 8 * * 0  su - oracle -c "sh /mesbk/scripts/backupLev0_log.sh>> /dev/null 2>&1"
0  23 * * 1,2,3,4,5,0 su - oracle -c "/mesbk/scripts/backupLev1.sh"
30 8 * * 1,2,3,4,5,6 su - oracle -c "sh /mesbk/scripts/backupLev1_log.sh>> /dev/null 2>&1"

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30126024/viewspace-2128114/,如需轉載,請註明出處,否則將追究法律責任。

相關文章