您的位置:首页 > 数据库 > Oracle

oracle rman 备份脚本

2016-01-28 15:01 639 查看
[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 {} \;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: