ITPub博客

首页 > Linux操作系统 > Linux操作系统 > rman的每星期全备份/每日备份

rman的每星期全备份/每日备份

原创 Linux操作系统 作者:baizhaoxian 时间:2008-12-24 16:06:33 0 删除 编辑

RMAN script
create script. level0backup{
allocate channel d1 type disk;
allocate channel d2 type disk;
backup
incremental level 0
format '/oradata/oradata/rman/con_%d_%s_%p.bak'
tag = sunday_datafile
filesperset 5
(database include current controlfile);
sql 'alter system archive log current';
release channel d1;
release channel d2;}

create script. level2backup{
allocate channel d1 type disk;
allocate channel d2 type disk;
backup
incremental level 2 cumulative
format '/oradata/oradata/rman/con_%d_%s_%p.bak'
tag = every_datafile
filesperset 20
(database include current controlfile);
sql 'alter system archive log current';
release channel d1;
release channel d2;
execute script. archbackup;}

create script. archbackup{
allocate channel d2 type disk ;
backup
format '/oradata/oradata/rman/con_%s_%p_t%t_al.bak'
filesperset 20
archivelog all delete input;
release channel d2;
}

 

unix (compaq true64) shell script

1. rman_con_sunday.rcv
# backup on sunday.

run{execute script. level0backup;}
run{execute script. archbackup;}

2.rman_con_everyday.rcv
# backup on everyday.
run{execute script. level2backup;}

3. rman_sunday.sh
#run on sunday
#define file name
today=`date +"%C%y%m%d"`
export $today
cmdfile=/oradata/oradata/rman_script/rman_con_sunday.rcv
export $cmdfile
msglog=/oradata/oradata/rman_log/rman$today.log
export $msglog
target='target sys/sys '
export $target
rcvcat='catalog rman/rman@rman '
export $rcvcat
# run rman
rman $target $rcvcat cmdfile $cmdfile msglog=$msglog

4. rman_everyday.sh
#run on everyday
#define file name
today=`date +"%C%y%m%d"`
export $today
cmdfile=/oradata/oradata/rman_script/rman_con_everyday.rcv
export $cmdfile
msglog=/oradata/oradata/rman_log/rman$today.log
export $msglog
target='target sys/sys '
export $target
rcvcat='catalog rman/rman@rman '
export $rcvcat
# run rman
rman $target $rcvcat cmdfile $cmdfile msglog=$msglog

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14136468/viewspace-521119/,如需转载,请注明出处,否则将追究法律责任。

上一篇: SQL_Plus操作命令
请登录后发表评论 登录
全部评论

注册时间:2008-10-23

  • 博文量
    29
  • 访问量
    123548