rman_backup_4T.sh
source ~/.bash_profile;
back_path="/HS5080";
back_log="/HS5080/log";
rman_bin="/u01/app/oracle/product/11.2.0/db_1/bin";
date_w=`date +%u`;
case $date_w in
6)
if [ ! -d "$back_path/`date +%m-%d`" ]; then
mkdir $back_path/`date +%m-%d`
fi
$rman_bin/rman nocatalog log $back_log/level0_`date +%Y-%m-%d`.log <<EOF
connect target /
run {
allocate channel d1 type disk maxpiecesize 16g;
allocate channel d2 type disk maxpiecesize 16g;
allocate channel d3 type disk maxpiecesize 16g;
allocate channel d4 type disk maxpiecesize 16g;
backup incremental level 0 database format '$back_path/`date +%m-%d`/DATA_level0_%d_%s_%p_%u.bak'
plus archivelog format '$back_path/`date +%m-%d`/archivelog_%d_%s_%p_%u.bak' delete all input;
release channel d4;
release channel d3;
release channel d2;
release channel d1;
}
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
exit;
EOF
;;
1|2|3|4|5|7)
if [ ! -d "$back_path/`date +%m-%d`" ];then
mkdir $back_path/`date +%m-%d`
fi
$rman_bin/rman nocatalog log $back_log/level1_`date +%Y-%m-%d`.log <<EOF
connect target /
run {
allocate channel d1 type disk maxpiecesize 8g;
allocate channel d2 type disk maxpiecesize 8g;
backup incremental level 1 database format '$back_path/`date +%m-%d`/level1_%d_%s_%p_%u.bak' plus archivelog format '$back_path/`date +%m-%d`/archivelog_%d_%s_%p_%u.bak' delete all input;
release channel d2;
release channel d1;
}
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
exit;
EOF
;;
esac