ORACLE 一个完整的rman备份脚本

#!/bin/bash
. ~/.bash_profile
export ORACLE_SID=prdrisk
DATE1=`date '+%Y%m%d'_%H%M%S`
mv /dbfile/scripts/log/*.log /dbfile/scripts/logs/.


$ORACLE_HOME/bin/rman log=/dbfile/scripts/log/Rman_prdrisk_$DATE1.log << EOF
connect target /;
crosscheck archivelog all;
run {
    allocate channel ch1 device type disk ;
    report schema;
    crosscheck backup of database;
    crosscheck backup of archivelog all;
    crosscheck backup of controlfile;
    crosscheck backup of spfile;
    crosscheck archivelog all;
    delete noprompt force expired backup;
    delete noprompt force expired archivelog until time 'sysdate-0.5';
    delete noprompt force expired copy;
    delete noprompt force obsolete;
    report need backup;
    report unrecoverable;
    release channel ch1;
}
run{
allocate channel ch1 device type disk maxpiecesize=4096M;
allocate channel ch2 device type disk maxpiecesize=4096M;
allocate channel ch3 device type disk maxpiecesize=4096M;
allocate channel ch4 device type disk maxpiecesize=4096M;
backup  as compressed backupset incremental level 0 
format '/dbfile/rmanbak/prdrisk_%p_%s_%u.ful'
(database);
sql 'alter system archive log current';
backup as compressed backupset 
 format '/dbfile/rmanbak/prdrisk_%p_%s_%u.arb'
(archivelog all);
backup
 format '/dbfile/rmanbak/prdrisk_%p_%s.ctb'
(current controlfile);
backup spfile format '/dbfile/rmanbak/%d_sp_%s_%p_%t.sbk' tag 'spfile_backup';
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
}
exit;
EOF
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值