ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 单机rman备份脚本

单机rman备份脚本

原创 Linux操作系统 作者:thompsun 时间:2011-03-03 09:19:31 0 删除 编辑

crontab配置如下:

-----------------------------------------------------------------------------------------------

0 3 * * 2,6 sh /home/oracle/shell/rman.sh >/home/oracle/shell/log/rman_`date +\%Y\%m\%d-\%H-\%M-\%S`.log 2>&1

 

脚本内容如下:

-------------------------------------------------------------------------------------------------

#!/bin/bash
.  ~/.bash_profile
ORACLE_SID=oadb
BACKUP_HOME='/oracle/backup_rman';

rman target / <run{
CONFIGURE RETENTION POLICY TO REDUNDANCY 4;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '$BACKUP_HOME/%F';
allocate channel v1 type disk;
allocate channel v2 type disk;
crosscheck copy;
crosscheck backup;
crosscheck archivelog all;
delete noprompt expired copy;
delete noprompt expired backup;
delete noprompt expired archivelog all;
delete noprompt obsolete;
backup database format '$BACKUP_HOME/%d_full_%s_%p_%c_%T.bak';
backup current controlfile format '$BACKUP_HOME/%d_control_%s_%c_%p_%T.ctl';
backup archivelog all format '$BACKUP_HOME/%d_arch_%s_%c_%p_%T.bak';
release channel v1;
release channel v2;}
exit;
EOF

find /home/oracle/shell/log -name "rman*log" -mtime +30 -print -exec rm {} \;

-------------------------------------------------------------------------------------------------

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

请登录后发表评论 登录
全部评论

注册时间:2009-01-11

  • 博文量
    96
  • 访问量
    251549