#!/usr/bin/ksh
back_path="/xiaoniu";
back_log="/xiaoniu";
rq=` date +"20%y%m%d%H%M%S" `
rman target / log=$back_log/backupall_$rq.log<run { 
allocate channel d1 type disk;
allocate channel d2 type disk;
crosscheck backup;
crosscheck archivelog all;
sql 'alter system archive log current';
backup incremental level 0 database format '$back_path/db_%d_%T_%U' tag='level 0' include current controlfile;
sql 'alter system archive log current';
backup archivelog all format '$back_log/arc_%t_%s' delete all input;
crosscheck backup;
crosscheck archivelog all;
release channel d2;
release channel d1;
}  
delete noprompt expired backup;
delete noprompt obsolete;
resync catalog;
exit
EOF