RMAN备份脚本
Posted liang545621
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RMAN备份脚本相关的知识,希望对你有一定的参考价值。
单机环境全备
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/[email protected]‘;
allocate channel c2 device type disk connect ‘sys/[email protected]‘;
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备份脚本的主要内容,如果未能解决你的问题,请参考以下文章
RMAN备份脚本执行遇到RMAN-03002,06091问题处理