设为首页 加入收藏

TOP

RMAN--full--incr0--incr1三合一脚本(一)
2015-07-24 09:25:27 来源: 作者: 【 】 浏览:0
Tags:RMAN--full--incr0--incr1 三合一 脚本

?

-h 查看帮助信息

[oracle@gc1 ~]$ sh backup.sh -h
The following information teach you how to use this script
backup.sh --full
backup.sh --incr0 
backup.sh --incr1 
THE is the place where you want to store the backup
After you set the RMAN_HOME , The script will create the following directory:
-- 2015_06_01
|-- archlog --This directory store your archivelog backup
|-- ctlfile --This directory store your controlfile bakcup
|-- data --This directory store your backup
| |-- incr0 --This is your incr0 backupset
-- log --This is your backup log directory
|-- dbbak.log --This log records the backup start and finish time points
|-- incr0_2015-06-01.log --This your backup log records the rman output information
backup.sh --help
Usage:
backup.sh --full 
backup.sh --incr0 
backup.sh --incr1 
backup.sh --help

#!/bin/bash

cmd=$1
script_name=`basename $0`
RMAN_HOME=$2/`date +%Y_%m_%d`


print_usage() {
echo "Usage:"
echo " $script_name --full "
echo " $script_name --incr0 "
echo " $script_name --incr1 "
echo " $script_name --help "
}


print_help() {
echo "The script was written by FAN"
echo "The following information teach you how to use this script"
echo " $script_name --full"
echo " $script_name --incr0 "
echo " $script_name --incr1 "
echo " THE is the place where you want to store the backup"
echo " After you set the RMAN_HOME , The script will create the following directory:"
echo " -- 2015_06_01"
echo " |-- archlog --This directory store your archivelog backup"
echo " |-- ctlfile --This directory store your controlfile bakcup"
echo " |-- data --This directory store your backup"
echo " | |-- incr0 --This is your incr0 backupset"
echo " -- log --This is your backup log directory"
echo " |-- dbbak.log --This log records the backup start and finish time points"
echo " |-- incr0_2015-06-01.log--This your backup log records the rman output information"
echo " $script_name --help"
print_usage
}


full() {
#-----------------------script env-----------------------


local LOGFILE=$RMAN_HOME/$datedir/log/dbbak.log


local LOGDATE=`date +%Y-%m-%d`
local RMANLOG=$RMAN_HOME/$datedir/log/full_${LOGDATE}.log


if [ ! -d ${RMAN_HOME} ];
then mkdir -p $RMAN_HOME
mkdir $RMAN_HOME/archlog
mkdir $RMAN_HOME/ctlfile
mkdir $RMAN_HOME/data
mkdir $RMAN_HOME/log
mkdir $RMAN_HOME/data/full
fi


if [ ! -f ${LOGFILE} ];
then touch ${LOGFILE}
fi


if [ ! -f ${RMANLOG} ];
then touch ${RMANLOG}
fi
#-------------start backup-----------------


echo "-------------------------Rman full backup -------------------------" >> ${LOGFILE}
echo "backup_full start time:" `date +%Y-%m-%d_%H:%M:%S` >> ${LOGFILE}
echo "----------------------Rman Database backup_full ------------"`date +%Y-%m-%d_%H:%M:%S` >${RMANLOG}


$ORACLE_HOME/bin/rman target / <> ${RMANLOG}
run
{
delete noprompt obsolete;
crosscheck archivelog all;
delete noprompt expired archivelog all;
allocate channel c1 type disk MAXPIECESIZE 5g;
allocate channel c2 type disk MAXPIECESIZE 5g;
allocate channel c3 type disk MAXPIECESIZE 5g;
allocate channel c4 type disk MAXPIECESIZE 5g;
allocate channel c5 type disk MAXPIECESIZE 5g;
backup AS COMPRESSED BACKUPSET database tag 'fullbackup' filesperset 3 format '$RMAN_HOME/data/full/db_full_%T_%d_%t_%s_%p.rbck' include current controlfile;
ba
首页 上一页 1 2 3 下一页 尾页 1/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇SecureCRT终端上编写hbaseshell脚.. 下一篇抽取、清洗varchar2到number类型..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·定义一个类模板并实 (2025-12-27 06:52:28)
·一文搞懂怎么用C语言 (2025-12-27 06:52:25)
·常用C模板范文_百度 (2025-12-27 06:52:21)
·【C语言】动态内存管 (2025-12-27 06:23:20)
·C语言中的内存管理 - (2025-12-27 06:23:16)