RMAN恢复脚本案例
Posted ClarkYu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RMAN恢复脚本案例相关的知识,希望对你有一定的参考价值。
$ crontab -l
0 12,19 * * * $ORACLE_HOME/scripts/arcbkup.sh
59 03 * * * $ORACLE_HOME/scripts/dbbkup.sh
30 9 * * * $ORACLE_HOME/scripts/delete.sh
5 20 * * * $ORACLE_HOME/nmon.sh
$ more $ORACLE_HOME/scripts/arcbkup.sh
#/usr/bin/sh
#. XXX.env
. XXX.env
rman target / cmdfile=XXX/bkup_proarc.rman log=XXX.log
exit 0
$ more /u3/ERP/db/tech_st/11.2.0/scripts/dbbkup.sh
#/usr/bin/sh
#. XXX.env
. XXX.env
rman target / cmdfile=XXX/bkup_orapro.rman log=XXX.log
exit 0
$ more /u3/ERP/db/tech_st/11.2.0/scripts/delete.sh
#/usr/bin/sh
#. XXX.env
. XXX.env
rman target / cmdfile=XXX/delete.rman log=XXX.log
exit 0
$ more bkup_proarc.rman
run {
allocate channel aaa device type sbt;
sql ‘alter system archive log current‘;
backup
filesperset 40
format ‘al_%s_%p_%t‘
archivelog all delete input;
release channel aaa;
}
$ more bkup_orapro.rman
run {
allocate channel c1 device type sbt;
allocate channel c2 device type sbt;
backup
filesperset 40
format ‘%d_%t_%s_%p‘
tag tiv_full
database;
sql ‘alter system archive log current‘;
backup
filesperset 60
tag arclog
archivelog all delete input;
backup current controlfile;
release channel c1;
release channel c2;
}
$ more delete.rman
run {
delete noprompt obsolete;
}
另外一种备份方式:
[[email protected] db]$ more /script/fullback.sh
#!/bin/sh
export ORACLE_HOME=XXX
export ORACLE_SID=XXX
$ORACLE_HOME/bin/rman log=XXX/fullback.log <<EOF
connect target /
connect catalog rman/[email protected]
run{
allocate channel ‘d1‘ type disk;
allocate channel ‘d2‘ type disk;
allocate channel ‘d3‘ type disk;
backup incremental level=0 database format=‘XXX/%U.bak‘ tag=‘full_bak‘;
sql ‘alter system archive log current‘;
backup format ‘XXX/log/%U.bak‘ archivelog from time ‘sysdate-7‘;
DELETE noprompt ARCHIVELOG ALL COMPLETED BEFORE ‘sysdate-7‘;
release channel d1;
release channel d2;
release channel d3;
}
exit;
EOF
[[email protected] db]$ more XXX/deleteback.sh
#!/bin/sh
export ORACLE_HOME=XXX
export ORACLE_SID=XXX
$ORACLE_HOME/bin/rman log=XXX/deleteback.log <<EOF
connect target /
connect catalog rman/[email protected]
run{
crosscheck backup;
delete noprompt obsolete;
}
exit;
EOF
windows平台备份脚本(需测试):
RUN {
allocate channel c1 type disk;
backup database format ‘c:/rman_backup/db_%U‘ plus archivelog format ‘c:/rman_backup/arch_%U‘;
release channel c1;
}
以上是关于RMAN恢复脚本案例的主要内容,如果未能解决你的问题,请参考以下文章
KingbaseES V8R3备份恢复案例之---sys_rman物理备份异机恢复