oracle rman 备份脚本

[oracle@qyxxmh_db1 ~]$ cat /home/oracle/orabackup/fullbackup.sh
#!/bin/sh
. /home/oracle/.bash_profile
rman  log ='/home/oracle/orabackup/fulltmp.log'  <<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 as compressed backupset format 'full_%d_%t_%s_%p_%T.dbf' database;
 release channel d1;
 release channel d2;
 release channel d3;
 release channel d4;
}
run {
 allocate channel d1 type disk;
 allocate channel d2 type disk; 
allocate channel d3 type disk;
 crosscheck backup;
 crosscheck archivelog all;     
 delete noprompt obsolete;
 delete noprompt expired backup;
 delete noprompt expired archivelog all;
 release channel d1;
 release channel d2;
release channel d3;
}
exit;
EOF
cat /home/oracle/orabackup/fulltmp.log >>/home/oracle/orabackup/fullbackup.log
cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs
cp  *.dbf  /sharedisk/rman_bak/
find /sharedisk/rman_bak/ -mtime +2 -type f -name "full*.dbf" -exec rm -rf {} \;


----------------------------------------------------------------------------------------
[oracle@qyxxmh_db1 ~]$ cat  /home/oracle/orabackup/archbackup.sh 
. /home/oracle/.bash_profile
rman  log ='/home/oracle/orabackup/archtmp.log'  <<EOF
connect target /
run {
allocate channel d1 type disk;
backup as compressed backupset archivelog all format 'al_%d_%t_%s_%p_%T.dbf';
allocate channel d2 type disk;
crosscheck backup;
crosscheck archivelog all;
delete noprompt obsolete;
delete noprompt expired backup;
delete noprompt expired archivelog all;
release channel d1;
release channel d2;
}
exit;
EOF
cat /home/oracle/orabackup/archtmp.log >> /home/oracle/orabackup/archfull.log
cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs
cp al*.dbf  /sharedisk/rman_bak/
find /sharedisk/rman_bak/ -mtime +2 -type f -name "al*.dbf" -exec rm -rf {} \;

你可能感兴趣的:(oracle rman 备份脚本)