码迷,mamicode.com
首页 > 其他好文 > 详细

RMAN备份脚本

时间:2018-08-03 01:19:29      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:OLE   exp   ice   archive   type   sql   tab   lang   脚本   

 
单机环境全备
 
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=hncdfpos001
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH=$ORACLE_HOME/bin:$PATH
rman target / log /backup/hncdfpos001/rman_full.log append<<EOF
run
{allocate channel c1 type disk;
allocate channel c2 type disk;
backup database filesperset 4 format ‘/backup/hncdfpos001/full_%d_%T_%s_%p‘;
sql ‘alter system archive log current‘;
backup archivelog all format ‘/backup/hncdfpos001/arch_%d_%T_%s_%p‘ delete input;
backup current controlfile format ‘/backup/hncdfpos001/ctl_%d_%T_%s_%p‘;
crosscheck backup;
crosscheck archivelog all;
delete noprompt obsolete;
delete noprompt  expired backup;
delete noprompt  expired archivelog all;
}
EOF
 
 
单机环境备归档
 
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=hncdfpos001
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH=$ORACLE_HOME/bin:$PATH
rman target / log /backup/hncdfpos001/rman_arch.log append<<EOF
run
{allocate channel c1 type disk;
allocate channel c2 type disk;
sql ‘alter system archive log current‘;
backup archivelog all format ‘/backup/hncdfpos001/arch_%d_%T_%s_%p‘ delete input;
backup current controlfile format ‘/backup/hncdfpos001/ctl_%d_%T_%s_%p‘;
crosscheck backup;
crosscheck archivelog all;
delete noprompt  expired backup;
delete  noprompt expired archivelog all;
}
EOF
 
 
 
RAC环境全备
 
run {
allocate channel c1 device type disk connect ‘sys/Oracle11@rac101‘;
allocate channel c2 device type disk connect ‘sys/Oracle11@rac102‘;
backup database database format ‘/backup/rmanbak/db_full_%T_%d_%t_%s_%p_bak0‘;
sql ‘alter system archive log current‘;
backup archivelog all format ‘/backup/rmanbak/arch_%T_%d_%t_%s_%p_bak0‘ delete input;
backup current controlfile format ‘/backup/rmanbak/controlfile_%T_%d_%t_%s_%p_bak0‘;
backup spfile format ‘/backup/rmanbak/spfile_%T_%d_%t_%s_%p_bak0‘;
crosscheck backup;
crosscheck archivelog all;
delete noprompt obsolete;
delete noprompt expired backup;
delete noprompt expired archivelog all;
release channel c1;
release channel c2;
}
 
 

RMAN备份脚本

标签:OLE   exp   ice   archive   type   sql   tab   lang   脚本   

原文地址:https://www.cnblogs.com/liang545621/p/9410649.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!