Home > Database > Mysql Tutorial > body text

RMAN自动备份脚本一例

WBOY
Release: 2016-06-07 17:12:05
Original
970 people have browsed it

1、Oracle定时任务: crontab -e * * * * * /home/oracle/workspace/scripts/bk_main.shgt;gt; /home/oracle/workspace/log/bk

Linux公社

首页 → 数据库技术

背景:

阅读新闻

RMAN自动备份脚本一例

[日期:2012-03-08] 来源:Linux社区  作者:renfengjun [字体:]

1、Oracle定时任务:

crontab -e

* * * * * /home/oracle/workspace/scripts/bk_main.sh>> /home/oracle/workspace/log/bk_err.log 2>&1

2、主控制程序

/home/oracle/workspace/scripts/bk_main.sh

#!/bin/bash

 

dat=`date +'%M'`

 

if (($dat==0))

then

 /home/oracle/workspace/scripts/bk_.sh 0

elif (($dat%50==0))

then

 /home/oracle/workspace/scripts/bk_.sh 2

elif (($dat%40==0))

then

 /home/oracle/workspace/scripts/bk_.sh 2

elif (($dat%30==0))

then

 /home/oracle/workspace/scripts/bk_.sh 1

elif (($dat%20==0))

then

 /home/oracle/workspace/scripts/bk_.sh 2

elif (($dat%10==0))

then

 /home/oracle/workspace/scripts/bk_.sh 2

fi

3、详细备份脚本

小说明:`date +'%Y%m%d%k%M' | awk '{print $1$2}'` 为当前时间的yyyymmddhh24mi格式

/home/oracle/workspace/scripts/bk_.sh

#!/bin/bash

#This is a import statement.

PATH=$PATH:$HOME/bin

 

export PATH

export ORACLE_SID=dex

export ORACLE_BASE=/u01/apps/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11gr2/db_1

export PATH=$ORACLE_HOME/bin:$PATH

#use awk to cut the space char

timst=`date +'%Y%m%d%k%M' | awk '{print $1$2}'`

#Use for debug

#echo $timst

#Create a directory like 201112140112

mkdir /u01/backup/DEX/backups/$timst

#Rman backup scripts

rman target sys/xiaojun@dex log=/home/oracle/workspace/log/rmanlog/rman_$timst

run{

allocate channel dev1 type disk ;

allocate channel dev2 type disk ;

backup incremental level 1 database format '/u01/backup/DEX/backups/$timst/bk_%t_%s' plus archivelog format'/u01/backup/DEX/backups/$timst/arc_%t_%s' delete all input ;

crosscheck backup ;

delete noprompt obsolete ;

delete noprompt expired backup;

}

EOF


不要忘记建立相应的目录。

linux

  • 0
  • RAC环境下,,创建spfile导致节点间数据库参数不一致的问题

    使用RMAN备份片信息远程恢复数据库一例

    相关资讯       RMAN 

    图片资讯      

    本文评论   查看全部评论 (0)

    评论声明

    最新资讯

    本周热门

    Linux公社简介 - 广告服务 - 网站地图 - 帮助信息 - 联系我们
    本站(LinuxIDC)所刊载文章不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。


    Copyright © 2006-2014 Linux公社 All rights reserved 浙ICP备06018118号

    Related labels:
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template