日期:2014-05-17 浏览次数:20999 次
-- 一个增量备份的例子:
#!/bin/bash
# incremental level 0 backup script
source /home/oracle/.bash_profile
current_day=`date +%Y%m%d`
incr_day=102_incr_$current_day
mkdir /data/oracle/ora_backup/$incr_day
echo '-------------------------------------'
echo "-- Begin Increment Backup of DB 10.103.23.102 DateTime: `date` --"
echo '-------------------------------------'
rman target / <<EOF
run
{
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/data/oracle/ora_backup/$incr_day/PID-%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 4;
crosscheck backup;
delete noprompt obsolete;
delete noprompt expired backup;
allocate channel dev1 type disk maxpiecesize=30720M;
allocate channel dev2 type disk maxpiecesize=30720M;
allocate channel dev3 type disk maxpiecesize=30720M;
allocate channel dev4 type disk maxpiecesize=30720M;
backup as compressed backupset incremental level 1 tag='db1'
format '/data/oracle/ora_backup/$incr_day/%n_%T_%U' database;
sql 'alter system archive log current';
backup archivelog all format '/data/oracle/ora_backup/$incr_day/arc_%n_%T_%U' delete all input;
release channel dev1;
release channel dev2;
release channel dev3;
release channel dev4;
}
EOF
echo '------------------------------------'
echo "-- End Increment Backup of DB 10.103.23.102 DateTime: `date` --"
echo '------------------------------------'
scp -l 51200 -r /data/oracle/ora_backup/$incr_day oracle@10.103.23.103:/data/oracle/ora_backup102 &
wait
echo '------------------------------------'
echo "-- End of Send file to 10.103.23.103 DateTime: `date` --"
echo '------------------------------------'
echo ''
echo ''