1. <var id="fe6gj"></var>

    <rp id="fe6gj"><nav id="fe6gj"></nav></rp>

    <noframes id="fe6gj"><cite id="fe6gj"></cite>

    <ins id="fe6gj"><button id="fe6gj"><p id="fe6gj"></p></button></ins>
    1. <tt id="fe6gj"><i id="fe6gj"><sub id="fe6gj"></sub></i></tt>
        始創于2000年 股票代碼:831685
        咨詢熱線:0371-60135900 注冊有禮 登錄
        • 掛牌上市企業
        • 60秒人工響應
        • 99.99%連通率
        • 7*24h人工
        • 故障100倍補償
        您的位置: 網站首頁 > 幫助中心>文章內容

        RMAN自動備份和磁帶機備份SHELL腳本

        發布時間:  2012/8/26 16:15:17

        (1)遠程TELNET備份數據到磁帶機的SHLL腳本

        lgmfis:/u01/Oracle/CIC/BACKUP ] cat TAPE_BACKUP.sh
        : ${OK=0} ${FAIL=1} ${CANCEL=3}
        : ${MM=`date +%m`}
        : ${DD=`date +%d`}
        : ${YY=`date +%Y`}
        : ${DEVFILn='/dev/rmt/0cn'}
        -
         

        : ${FLOG=/u01/Oracle/CIC/LOG/TAPE_bk_${MM}${DD}.log}
        : ${FLST=/u01/Oracle/CIC/LOG/TAPE_bk_${MM}${DD}.lst}
        : ${HOST=`uname -n`}
        . /u01/Oracle/CIC/BACKUP/common.sh
        START_YMD=`date +%Y%m%d`
        START_HMS=`date +%H%M%S`
        echo "  $HOST TAPE Backup start at $START_YMD $START_HMS    "     >> $FLOG
        #chkdate=`get_before_date ${YY}${MM}${DD}`
        #tmpdate=`expr substr $chkdate 5 5`
        /usr/bin/mt -f ${DEVFILn} rewind

        if [ $? -eq 0 ]
        then
           echo "## Tape Check : Success/n"                          >> $FLOG
           echo "## Tape Check : Success/n"
        else
           echo "## Tape Check : Error(Insert tape into Device)/n"   >> $FLOG
           echo "## Tape Check : Error(Insert tape into Device)/n"

           exit ${FAIL}
        fi

        echo "## Step 1 : FULL Backup                 ###"        >> $FLOG

        cd /

        find fz02/RMANBK/lgmfis/*${MM}${DD}* -print|sort -rn +1|head -9| cpio -ocv -H od

        c -C 30720 -O $DEVFILn | tee -a $FLST

        find u08/EXP_BK/FZLFMES/*${MM}${DD}.* -print | cpio -ocv -H odc -C 30720 -O $DEV

        FILn | tee -a $FLST


        mt -f $DEVFILn offline
        echo "## Step 1 : FULL Backup    End             ###"        >> $FLOG

        echo "please insert the secound tape"
        Getyn "Was the secound tape insert? (y/n)"

        echo "## Step 2 : lgmfis db file & EXP Backup                 ###"        >> $FL

        OG

        /usr/bin/mt -f ${DEVFILn} rewind
        cd /

        find fz02/RMANBK/lgmfis/*${YY}${MM}${DD}* -print|sort -n +1|head -7| cpio -ocv -

        H odc -C 30720 -O $DEVFILn | tee -a $FLST
        #find u08/EXP_BK/lgmfis/*${MM}${DD}.* -print | cpio -ocv -H odc -C 30720 -O $DEV

        FILn | tee -a $FLST

        echo "## Step 2 : lgmfis db file & EXP Backup    END             ###"        >>

        $FLOG

        mt -f $DEVFILn offline
        echo "please insert the third tape"
        Getyn "Was the third tape insert? (y/n)"

        /usr/bin/mt -f ${DEVFILn} rewind
        cd /

        echo "## Step 3 : lgmfis arch & FZLFMES DATAFILE & ARCH & export Backup

                ###"        >> $FLOG
        find fz01/RMANBK/FZLFMES/*${MM}${DD}* -print | cpio -ocv -H odc -C 30720 -O $DEV

        FILn | tee -a $FLST
        find fz02/RMANBK/lgmfis/*${MM}${DD}* -print|sort -rn +1|sed -n '10,11p;11q'| cpi

        o -ocv -H odc -C 30720 -O $DEVFILn | tee -a $FLST
        echo "## Step 3 : lgmfis arch & FZLFMES DATAFILE & ARCH & export Backup   End

         ###"   >> $FLOG

        mt -f $DEVFILn offline

        echo "please insert the fourth tape"
        Getyn "Was the fourth tape insert? (y/n)"

        /usr/bin/mt -f ${DEVFILn} rewind
        cd /

        echo "## Step 4 : lgmfis arch & FZLFMES DATAFILE & ARCH & export Backup

                ###"        >> $FLOG
        find u08/EXP_BK/lgmfis/*${MM}${DD}.* -print | cpio -ocv -H odc -C 30720 -O $DEVF

        ILn | tee -a $FLST
        find u08/RMANBK/lgmfis/*${MM}${DD}* -print | cpio -ocv -H odc -C 30720 -O $DEVFI

        Ln | tee -a $FLST
        echo "## Step 4 : lgmfis arch & FZLFMES DATAFILE & ARCH & export Backup   End

         ###"   >> $FLOG

        cd /


        (2)自動RMAN腳本:

        [lgmfisu:root] /u01/Oracle/CIC/BACKUP> cat DB_FULL_lgmfis.sh
        MM=`date +%m`
        DD=`date +%d`
        YY=`date +%y`

        RMAN_LOG_FILE=/u01/Oracle/CIC/LOG/FULL_HOT_lgmfis_${YY}${MM}${DD}.log

        Oracle_HOME=/u01/app/oracle/product/9.2.0
        export Oracle_HOME

        Oracle_SID=lgmfis
        export Oracle_SID
        Oracle_HOME=$ORACLE_HOME
        export Oracle_HOME
        Oracle_SID=$ORACLE_SID
        export Oracle_SID
        #find /fz02/RMANBK/lgmfis -mtime +0 -exec rm {} /;
        find /u08/RMANBK/lgmfis -mtime +0 -exec rm {} /;
        rm -f /fz02/RMANBK/lgmfis/db_full*

        /u01/app/Oracle/product/9.2.0/bin/rman target / nocatalog msglog $RMAN_LOG_FILE
        append << EOF
        RUN {
        BACKUP FULL
            FILESPERSET 4
            FORMAT '/fz02/RMANBK/lgmfis/db_full_%T_%s_%p'
            DATABASE;
        sql 'alter system archive log current';
        BACKUP
           filesperset 20
           FORMAT '/u08/RMANBK/lgmfis/al_%T_%s_%p'
           ARCHIVELOG ALL DELETE INPUT;
        BACKUP
            FORMAT '/fz02/RMANBK/lgmfis/cntrl_%T_%s_%p'
            CURRENT CONTROLFILE;
        }
        EOF

        #find /fz02/RMANBK/lgmfis -mtime +0 -exec rm {} /;
        #find /u08/RMANBK/lgmfis -mtime +0 -exec rm {} /;
        you have mail in /var/mail/root
        [lgmfisu:root] /u01/Oracle/CIC/BACKUP>

        mt -f $DEVFILn offline
        END_YMD=`date +%Y%m%d`
        END_HMS=`date +%H%M%S`

        echo "  $HOST  TAPE Backup Successfully Ended At $END_YMD $END_HMS    "     >> $

        FLOG

         

        另外個文件:COMMON.SH

        [lgmfisu:root] /u01/Oracle/CIC/BACKUP> cat common.sh
        get_before_date()
        {
         Y=`expr substr $1 1 4`
         M=`expr substr $1 5 2`
         D=`expr substr $1 7 2`
         YY=`expr $Y - 1`
         MM=`expr $M - 1`
         DD=`expr $D - 1`
         MM=`printf "%02d" $MM`
         DD=`printf "%02d" $DD`
         dd=$Y$MM
         dad=`get_mon_days $dd`
         be_date=$Y$M$DD
         if [ $D -eq 01 ]
         then
         if [ $M -ne 01 ]
         then
         be_date=$Y$MM$dad
         fi
         if [ $M -eq 01 ]
                        then
                                be_date=$YY"1231"
                        fi
           fi
                echo $be_date

        }


        Getyn() {
               while echo "/n$* (y/n)? /c"
                       do read yn
                                case "$yn" in
                                        [Yy] )  return $OK      ;;
                                        [Nn] )  ConfirmYn "cancel The Job ?" ;;
                                          *  ) echo "Please enter y or n"  ;;
                                esac
                        done
         }

        ConfirmYn() {
               while echo "/n$* (y/n)? /c"
                       do read yn
                                case "$yn" in
                                        [Nn] ) return $OK       ;;
                                        [Yy] ) echo "/n The Job is canceled."
                                               sleep 3
                                               exit $CANCEL     ;;
                                          *  ) echo "Please enter y or n"  ;;
                                esac
                        done
        }


        本文出自:億恩科技【www.endtimedelusion.com】

        服務器租用/服務器托管中國五強!虛擬主機域名注冊頂級提供商!15年品質保障!--億恩科技[ENKJ.COM]

      1. 您可能在找
      2. 億恩北京公司:
      3. 經營性ICP/ISP證:京B2-20150015
      4. 億恩鄭州公司:
      5. 經營性ICP/ISP/IDC證:豫B1.B2-20060070
      6. 億恩南昌公司:
      7. 經營性ICP/ISP證:贛B2-20080012
      8. 服務器/云主機 24小時售后服務電話:0371-60135900
      9. 虛擬主機/智能建站 24小時售后服務電話:0371-60135900
      10. 專注服務器托管17年
        掃掃關注-微信公眾號
        0371-60135900
        Copyright© 1999-2019 ENKJ All Rights Reserved 億恩科技 版權所有  地址:鄭州市高新區翠竹街1號總部企業基地億恩大廈  法律顧問:河南亞太人律師事務所郝建鋒、杜慧月律師   京公網安備41019702002023號
          0
         
         
         
         

        0371-60135900
        7*24小時客服服務熱線

         
         
        av不卡不卡在线观看_最近2018年中文字幕_亚洲欧美一区二区三区_一级A爱做片免费观看国产_日韩在线中文天天更新_伊人中文无码在线