#!/bin/sh
source /home/oracle/.bash_profile
$ORACLE_HOME/bin/rman <<EOF
connect target /
run{
allocate channel 'd1' type disk;
allocate channel 'd2' type disk;
allocate channel 'd3' type disk;
allocate channel 'd4' type disk;
backup full tag 'dbfull' format '/archive/backup/full%u_%p_%c' database;
sql 'alter system archive log current';
backup format '/archive/backup/%T_arch_%s_%p' archivelog all delete input;
release channel d1;
release channel d2;
release channel d3;
release channel d4;
}
list backup;
exit;
EOF
echo "-------------------------end------------------------------";date
crontab 的格式:
minutes|hours|day of month|month|day of week|
下面是在 CRONTAB 里面的语句
03 23 * * 0 /home/oracle/backupscript/b_fullbackup.sh
00 02 01 * *
上面是一个全备份。
下面是一个一零级备份的脚本:
source /home/oracle/.bash_profile
$ORACLE_HOME/bin/rman <<EOF
connect target /
run{
allocate channel 'd1' type disk;
allocate channel 'd2' type disk;
allocate channel 'd3' type disk;
allocate channel 'd4' type disk;
backup incremental level 0 cumulative tag 'db0' format '/home/oracle/backup/db0%u_%s_%p'
database;
sql 'alter system archive log current';
backup filesperset 4 archivelog all delete input;
delete noprompt obsolete;