oracle rnam 备份方案

oracle rnam 备份方案

周日晚上 oracle$>rman target / msglog=/u01/rmanbak/bakl0.log cmdfile=/u01/rmanbak/script/bakl0

周一晚上 oracle$>rman target / msglog=/u01/rmanbak/bakl1.log cmdfile=/u01/rmanbak/script/bakl1

周二晚上 oracle$>rman target / msglog=/u01/rmanbak/bakl2.log cmdfile=/u01/rmanbak/script/bakl2

周三晚上 oracle$>rman target / msglog=/u01/rmanbak/bakl3.log cmdfile=/u01/rmanbak/script/bakl3

周四晚上 oracle$>rman target / msglog=/u01/rmanbak/bakl4.log cmdfile=/u01/rmanbak/script/bakl4

周五晚上 oracle$>rman target / msglog=/u01/rmanbak/bakl5.log cmdfile=/u01/rmanbak/script/bakl5

周六晚上 oracle$>rman target / msglog=/u01/rmanbak/bakl6.log cmdfile=/u01/rmanbak/script/bakl6

注 level 0 全备份;level 2 增量备份; level 1  差量备份 参照http://www.itpub.net/658332.html

 

自动备份: 备份脚本+ linux下的crontab

在redhat linux 的 u01/rmanbak/script/目录下新建下面文件

bakl0 文件

run{

allocate channel c1 type disk;

backup incremental level 0 format "/u01/rmanbak/inc0_%u_%T" tag monday_inc0 database;

release channel c1;

}

bakl1 文件

run{

allocate channel c1 type disk;

backup incremental level 1 format "/u01/rmanbak/inc1_%u_%T" tag monday_inc0 database;

release channel c1;

}

bakl2 文件

run{

allocate channel c1 type disk;

backup incremental level 2 format "/u01/rmanbak/inc2_%u_%T" tag monday_inc0 database;

release channel c1;

}

执行脚本:

rman target / msglog=/u01/rmanbak/bakl0.log cmdfile=/u01/rmanbak/script/bakl0

rman target / msglog=/u01/rmanbak/bakl1.log cmdfile=/u01/rmanbak/script/bakl1

rman target / msglog=/u01/rmanbak/bakl2.log cmdfile=/u01/rmanbak/script/bakl2

 

编辑oracle用户自动执行计划

crontab 命令用法参照 : http://blog.csdn.net/yuanfeiyan/archive/2007/10/15/1825288.aspx

crontab -e -u oracle

 

内容:

30 23 * * 0 rman target / msglog=/u01/rmanbak/bakl0.log cmdfile=/u01/rmanbak/script/bakl0

30 23 * * 1 rman target / msglog=/u01/rmanbak/bakl0.log cmdfile=/u01/rmanbak/script/bakl2

30 23 * * 2 rman target / msglog=/u01/rmanbak/bakl0.log cmdfile=/u01/rmanbak/script/bakl2

30 23 * * 3 rman target / msglog=/u01/rmanbak/bakl0.log cmdfile=/u01/rmanbak/script/bakl1

30 23 * * 4 rman target / msglog=/u01/rmanbak/bakl0.log cmdfile=/u01/rmanbak/script/bakl2

30 23 * * 5 rman target / msglog=/u01/rmanbak/bakl0.log cmdfile=/u01/rmanbak/script/bakl2

30 23 * * 6 rman target / msglog=/u01/rmanbak/bakl0.log cmdfile=/u01/rmanbak/script/bakl2

 

注释:30 23 * * 0 表示 30分 23点 *日期 *月 0星期天

-e 编辑用户的Crontab文件

 

 

重启crontab 命令 : service cronb restart

 

如果不能执行。原因1、脚本是否是可执行脚本。2、oracle环境变量问题。 解决办法是在写个shall让crontab调用例如

a1、bakup1.sh 
rq=`date '+%y%m%d'`;
export ORACLE_HOME=/opt/app/oracle/9.2.0;
export ORACLE_SID=zhang;
export ORACLE_BASE=/opt/app/oracle;
export PATH=$ORACLE_HOME/bin;$PATH;
/opt/app/oracle/9.2.0/bin/rman target / msglog=/home/oracle/oraBak/autoBak/bakup1_$rq.log cmdfile=/home/oracle/oraBak/script/bakup2

 

 

你可能感兴趣的:(oracle,linux,.net,redhat,脚本)