注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

常在心

淡泊明志,人生自在

 
 
 

日志

 
 

oracle增量备份脚本  

2011-05-20 09:05:49|  分类: oracle备份恢复迁 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

【 0级全库备份 】

#!/bin/bash

export ORACLE_SID=ora10
export ORACLE_BASE=/ora10g
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0
date=`date +%y-%m-%d`
logdir=/script/log/
[ -d "$logdir" ] || mkdir -p $logdir

/ora10g/product/10.2.0/bin/rman catalog rman/rman123 target rman/rman@dic10 log="$logdir"/"$date"_10_inc0.log <<EOF
run {
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
allocate channel ch3 device type disk;
allocate channel ch4 device type disk;
allocate channel ch5 device type disk;
allocate channel ch6 device type disk;
allocate channel ch7 device type disk;
allocate channel ch8 device type disk;
sql 'alter system archive log current';
backup incremental level 0 database format '/backup/data/0_LEVEL_FULL_DATABASE_%T_%s.ful';
backup archivelog all format '/backup/data/ARCHIVE_LOG_%T_%s.arc' delete all input;
backup current controlfile format '/backup/data/CONTROL_FILE_%T_%s.ctl';
crosscheck backup;
crosscheck archivelog all;
delete noprompt expired backup;
delete noprompt obsolete;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
release channel ch5;
release channel ch6;
release channel ch7;
release channel ch8;
}
EOF


【 一级差异增量备份 】

#!/bin/bash

export ORACLE_SID=ora10
export ORACLE_BASE=/ora10g
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0
date=`date +%y-%m-%d`
logdir=/script/log/
[ -d "$logdir" ] || mkdir -p $logdir

/ora10g/product/10.2.0/bin/rman catalog rman/rman123 target rman/rman@dic10 log="$logdir"/"$date"_10_inc1.log <<EOF
run {
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
allocate channel ch3 device type disk;
allocate channel ch4 device type disk;
allocate channel ch5 device type disk;
allocate channel ch6 device type disk;
allocate channel ch7 device type disk;
allocate channel ch8 device type disk;
sql 'alter system archive log current';
backup incremental level 1 database format '/backup/data/1_LEVEL_INCREMENTAL_DATABASE_%T_%s.ful';
backup archivelog all format '/backup/data/ARCHIVE_LOG_%T_%s.arc' delete all input;
backup current controlfile format '/backup/data/CONTROL_FILE_%T_%s.ctl';
crosscheck archivelog all;
delete noprompt archivelog all;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
release channel ch5;
release channel ch6;
release channel ch7;
release channel ch8;
}
EOF


【 二级差异增量备份 】

#!/bin/bash

export ORACLE_SID=ora10
export ORACLE_BASE=/ora10g
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0
date=`date +%y-%m-%d`
logdir=/script/log
[ -d "$logdir" ] || mkdir -p $logdir

/ora10g/product/10.2.0/bin/rman catalog rman/rman123 target rman/rman@dic10 log="$logdir"/"$date"_10_inc2.log <<EOF
run {
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
allocate channel ch3 device type disk;
allocate channel ch4 device type disk;
allocate channel ch5 device type disk;
allocate channel ch6 device type disk;
allocate channel ch7 device type disk;
allocate channel ch8 device type disk;
sql 'alter system archive log current';
backup incremental level 2 database format '/backup/data/2_LEVEL_INCREMENTAL_DATABASE_%T_%s.ful';
backup archivelog all format '/backup/data/ARCHIVE_LOG_%T_%s.arc' delete all input;
backup current controlfile format '/backup/data/CONTROL_FILE_%T_%s.ctl';
crosscheck archivelog all;
delete noprompt archivelog all;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
release channel ch5;
release channel ch6;
release channel ch7;
release channel ch8;
}
EOF

  评论这张
 
阅读(1008)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017