ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Rman 定时备份crontab

Rman 定时备份crontab

Linux操作系统 作者:pooldb 时间:2016-05-19 16:41:55 0 删除 编辑

第一步:加入定时任务:

crontab - l

10 0 * * * /oradata_uat8/udb001/backup_db.sh  >  /oradata_uat8/udb001/b.log


// 每天凌晨0:10自动备份数据库。

第二步: shell 文件调用backup scripts. 

oracle@udends11>more backup_db.sh

#!/bin/sh
export ORACLE_HOME=/apps/ude/oracle/product/10.2.0/database
export PATH=$ORACLE_HOME/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:.
export ORACLE_BASE=/apps/ude/oracle
export PATH=$PATH:$ORACLE_HOME/bin:/$ORACLE_HOME/OPatch
export ORACLE_SID=udb001

cd /oradata_uat8/udb001/archive
rman target / CMDFILE udb_rman.rcv 

第三步:Rman backup scripts.

oracle@udends11>more udb_rman.rcv

#!/bin/sh
sql 'alter system switch logfile';
crosscheck archivelog all;
delete noprompt expired archivelog all;
crosscheck backup;
delete noprompt obsolete; 
delete expired copy;
run{
 allocate channel c1 type disk;
 allocate channel c2 type disk;
 allocate channel c3 type disk;
 allocate channel c4 type disk;
 allocate channel c5 type disk;
 allocate channel c6 type disk;
 allocate channel c7 type disk;
 allocate channel c8 type disk;
 backup database format '/oradata_uat8/udb001/rman/full_level0_%U';
 backup archivelog all delete all input skip inaccessible format '/oradata_uat8/udb001/rman/ARC_%U';
 backup current controlfile format '/oradata_uat8/udb001/rman/control_bak_%T';
 release channel c1;
 release channel c2;
 release channel c3;
 release channel c4;
 release channel c5;
 release channel c6;
 release channel c7;
 release channel c8;
 }

 

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

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

注册时间:2014-12-22

  • 博文量
    404
  • 访问量
    296519