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

常在心

淡泊明志,人生自在

 
 
 

日志

 
 

rman bakcup  

2011-03-28 13:42:23|  分类: 常用脚本查询 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

一、全备并备份归档

export ORACLE_SID=boss
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/10g/db_1
rq=` date +"20%y%m%d%H%M%S" `
/u01/app/oracle/product/10g/db_1/bin/rman target / log=/u01/app/oracle/rmanbak/backall_$rq.log<<EOF
run{
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
crosscheck backup;
crosscheck archivelog all;
sql 'alter system switch logfile';
backup database format '/u01/app/oracle/rmanbak/db_%U_%d';
sql  'alter system switch logfile';
backup archivelog all format '/u01/app/oracle/rmanbak/arch_%t_%s' delete all input;
backup format '/u01/app/oracle/rmanbak/con_%s_%p' current controlfile;
crosscheck backup;
crosscheck archivelog all;
delete noprompt expired backup;
delete noprompt obsolete;
delete noprompt backup of database completed before 'sysdate -15';
delete noprompt backup of archivelog all completed before 'sysdate -15';
release channel ch1;
release channel ch2;
}
EOF


archbk.sh
export ORACLE_SID=boss
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/10g/db_1
rq=` date +"20%y%m%d%H%M%S" `
/u01/app/oracle/product/10g/db_1/bin/rman target / log=/u01/app/oracle/rmanbak/backall_$rq.log<<EOF
run{
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
crosscheck backup;
crosscheck archivelog all;
sql 'alter system switch logfile';
backup archivelog all format '/u01/app/oracle/rmanbak/arch_%t_%s' delete all input;
crosscheck backup;
crosscheck archivelog all;
release channel ch1;
release channel ch2;
}
EOF

 

二、全备不备份归档

所谓不备份归档,只是将归档以NFS挂载的方式放到NFS存储服务器中

1)备份脚本

# User specific environment and startup profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/db10g
export ORACLE_SID=OA
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin

export PATH
unset USERNAME

#backup script
Curdate=`date +%Y%m%d`
$ORACLE_HOME/bin/rman target / nocatalog log /u03/backup/rmanbak/rmanbak$Curdate.log<<-EOF
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
sql 'alter system archive log current';
backup as compressed backupset database format '/u03/backup/rmanbak/OArmambak%T_%U';
sql 'alter system archive log current';
backup current controlfile format '/u03/backup/rmanbak/OAConrolfileBak%T_%U';
release channel c1;
release channel c2;
release channel c3;
}

report obsolete;
delete force noprompt obsolete;
crosscheck backup;
list backup;
EOF

2)NFS归档,参考《NFS归档设置》

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

历史上的今天

评论

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

页脚

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