rman多进程并发备份一个数据表空间脚本

原创 2016年11月10日 15:27:38
#!/bin/bash
export LANG=en_US
export ORACLE_HOME=/u01/app/product/10.2.0/db_1
export RMAN=$ORACLE_HOME/bin/rman
export ORACLE_SID=dbs1
export ORACLE_USER=oracle
export DAY=`date +%Y%m%d`  
export WEEKS=`date +%U`
export BACKUP_DIR=/u01/rman


export RMAN_LOG_FILE=$BACKUP_DIR/rman_"$ORACLE_SID"_$DAY.log

TODAY=`date`
USER=`id|cut -d "(" -f2|cut -d ")" -f1`
echo "=================$TODAY===================">$RMAN_LOG_FILE

echo "ORACLE_SID:  $ORACLE_SID">>$RMAN_LOG_FILE
echo "ORACLE_HOME: $ORACLE_HOME">>$RMAN_LOG_FILE
echo "ORACLE_USER: $ORACLE_USER">>$RMAN_LOG_FILE
echo "================================================================">>$RMAN_LOG_FILE
echo "                   ">>$RMAN_LOG_FILE
echo "BACKUP DATABASE BEGIN......">>$RMAN_LOG_FILE
echo "                   ">>$RMAN_LOG_FILE

chmod 666 $RMAN_LOG_FILE

BAK_LEVEL=0													       
#export BAK_LEVEL=$BAK_LEVEL
echo "Today is : `date +%A` incremental level $BAK_LEVEL">>$RMAN_LOG_FILE
echo "                   ">>$RMAN_LOG_FILE

RUN_STR="
export BAK_LEVEL=$BAK_LEVEL
export ORACLE_HOME=$ORACLE_HOME
export ORACLE_SID=$ORACLE_SID
$RMAN nocatalog TARGET / msglog $RMAN_LOG_FILE append <<EOF
run{
allocate channel c1 device type disk; 
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
allocate channel c5 device type disk;
allocate channel c6 device type disk;
allocate channel c7 device type disk;
allocate channel c8 device type disk;
allocate channel c9 device type disk;
allocate channel c10 device type disk;
backup tag 'tstpcc' format '/u01/rman/tpcc_0_%d_%u' tablespace tpcc100;
sql 'alter system archive log current' ;
backup format '/u01/rman/archivelog_%d_%u' (archivelog all);
release channel c10;
release channel c9;
release channel c8;
release channel c7;
release channel c6;
release channel c5;
release channel c4;
release channel c3;
release channel c2;
release channel c1;
}
allocate channel for maintenance device type disk;
report obsolete;
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
list backup summary;
release channel;
EOF
"

# Initiate the command string

if [ "$CUSER" = "root" ]
then
    echo "Root Command String: $RUN_STR" >> $RMAN_LOG_FILE    
    su - $ORACLE_USER -c "$RUN_STR" >> $RMAN_LOG_FILE
    RSTAT=$?
else
    echo "User Command String: $RUN_STR" >> $RMAN_LOG_FILE    
    /bin/sh -c "$RUN_STR" >> $RMAN_LOG_FILE
    RSTAT=$?
fi

# ---------------------------------------------------------------------------
# Log the completion of this script.
# ---------------------------------------------------------------------------

if [ "$RSTAT" = "0" ]
then
    LOGMSG="ended successfully"
else
    LOGMSG="ended in error"
fi

echo >> $RMAN_LOG_FILE
echo Script $0 >> $RMAN_LOG_FILE
echo ==== $LOGMSG on `date` ==== >> $RMAN_LOG_FILE
echo >> $RMAN_LOG_FILE
exit $RSTAT


版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

如何kill掉RMAN备份进程

题记:最近客户的一套订购数据库经常会因为数据及业务压力太大,在RMAN进行全备或是增备时,而此时业务有大量要处理时,系统资源就会被耗尽,会影响到业务的正常,所以常有时需要先终止掉RMAN备份,这里提供...

rman 总结(附一个AIX的全备份脚本)

控制备份片的大小: 1、一次性(通过限制通道,来限制备份片的大小): run{ allocate channel d1 type disk; set limit channel di kbytes=1...

47-将多进程并发服务器改成 IO 复用

只有趟过各种坑,解决了各种离奇古怪的网络编程异常,才能一步一步的提升,再一步一步的学习新的技术。前面的程序,我们只是先拿客户端进行了开刀,将其修改成了 IO 多路复用模型,因为它最简单。后面我还看到,...

TSM备份ORACLE的rman脚本

  • 2013-07-02 20:23
  • 38KB
  • 下载

【Unix 网络编程】服务器网络编程模型——多进程并发模型

在介绍多进程并发模型前,先看看之前的一个TCP socket 例子,一个同步阻塞迭代模型。其服务器端核心代码如下,完整代码参见前面链接, 同步阻塞迭代服务器模型:

rman备份策略及脚本

内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)