激情五月天婷婷,亚洲愉拍一区二区三区,日韩视频一区,a√天堂中文官网8

<ul id="buwfs"><strike id="buwfs"><strong id="buwfs"></strong></strike></ul>
    <output id="buwfs"></output>
  • <dfn id="buwfs"><source id="buwfs"></source></dfn>
      <dfn id="buwfs"><td id="buwfs"></td></dfn>
      <div id="buwfs"><small id="buwfs"></small></div>
      <dfn id="buwfs"><source id="buwfs"></source></dfn>
      1. <dfn id="buwfs"><td id="buwfs"></td></dfn>
        始創(chuàng)于2000年 股票代碼:831685
        咨詢熱線:0371-60135900 注冊有禮 登錄
        • 掛牌上市企業(yè)
        • 60秒人工響應(yīng)
        • 99.99%連通率
        • 7*24h人工
        • 故障100倍補(bǔ)償
        全部產(chǎn)品
        您的位置: 網(wǎng)站首頁 > 幫助中心>文章內(nèi)容

        Oracle教程:crontab+RMAN 日期備份腳本

        發(fā)布時間:  2012/8/26 16:15:53

        新接手了幾個客戶的數(shù)據(jù)庫,數(shù)據(jù)庫真是一團(tuán)糟糕,什么分區(qū),索引,表空間都十分的亂,最重要的是歸檔都沒有開,竟然還是生產(chǎn)庫,更別說什么備份腳本了,最近一直在做備份恢復(fù)的整理工作,該歸檔的停機(jī)歸檔,該建立腳本的建立備份腳本,以前庫少,現(xiàn)在庫多了,管理多個庫不能那么空閑了,現(xiàn)在的庫之前做了CRONTAB+RMAN的備份,做了些修改,記錄如下:

        2011-06-21修改RMAN參數(shù)以及備份腳本,實(shí)現(xiàn)7天后自動刪除失效備份集,同時添加定時任務(wù)的執(zhí)行結(jié)果到監(jiān)控郵件。
        1:修改RMAN參數(shù)修改RMAN失效日期為7天,同時修改自動備份控制腳本參數(shù)為開啟狀態(tài)。
        [Oracle@localhost ~]$ rman target /
        Recovery Manager: Release 10.2.0.1.0 - Production on Tue Jun 21 13:59:31 2011
        Copyright (c) 1982, 2005, Oracle.  All rights reserved.
        connected to target database: GIS (DBID=3650399296)

        RMAN> show all;
        RMAN configuration parameters are:
        CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
        CONFIGURE BACKUP OPTIMIZATION OFF; # default
        CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
        CONFIGURE CONTROLFILE AUTOBACKUP OFF;# default
        CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
        CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO BACKUPSET;
        CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
        CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
        CONFIGURE MAXSETSIZE TO UNLIMITED; # default
        CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
        CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
        CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
        CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/usr/app/db-server/ora_home/dbs/snapcf_gis.f'; # default

        RMAN> CONFIGURE CONTROLFILE AUTOBACKUP on;
        new RMAN configuration parameters:
        CONFIGURE CONTROLFILE AUTOBACKUP ON;
        new RMAN configuration parameters are successfully stored

        RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
        new RMAN configuration parameters:
        CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
        new RMAN configuration parameters are successfully stored

        RMAN> show all;
        RMAN configuration parameters are:
        CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
        CONFIGURE BACKUP OPTIMIZATION OFF; # default
        CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
        CONFIGURE CONTROLFILE AUTOBACKUP ON;
        CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
        CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO BACKUPSET;
        CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
        CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
        CONFIGURE MAXSETSIZE TO UNLIMITED; # default
        CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
        CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
        CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
        CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/usr/app/db-server/ora_home/dbs/snapcf_gis.f'; # default
        2:查看過期備份www.linuxidc.comRMAN> report obsolete;

        RMAN retention policy will be applied to the command
        RMAN retention policy is set to redundancy 1
        Report of obsolete backups and copies
        Type                 Key    Completion Time    Filename/Handle
        -------------------- ------ ------------------ --------------------
        Backup Set           2624   19-JUN-11        
          Backup Piece       2624   19-JUN-11          /sdb/opt/rman/rman/arch_level_0_GIS_20110619_2635_ibmf959t_1_1
        Backup Set           2623   19-JUN-11        
          Backup Piece       2623   19-JUN-11          /sdb/opt/rman/rman/arch_level_0_GIS_20110619_2636_icmf959t_1_1
        3:刪除過期備份集RMAN> delete noprompt obsolete;

        RMAN retention policy will be applied to the command
        RMAN retention policy is set to redundancy 1
        allocated channel: ORA_DISK_1
        channel ORA_DISK_1: sid=94 devtype=DISK
        allocated channel: ORA_DISK_2
        channel ORA_DISK_2: sid=137 devtype=DISK
        allocated channel: ORA_DISK_3
        channel ORA_DISK_3: sid=91 devtype=DISK
        Deleting the following obsolete backups and copies:
        Type                 Key    Completion Time    Filename/Handle
        -------------------- ------ ------------------ --------------------
        Backup Set           2624   19-JUN-11        
          Backup Piece       2624   19-JUN-11          /sdb/opt/rman/rman/arch_level_0_GIS_20110619_2635_ibmf959t_1_1
        Backup Set           2623   19-JUN-11        
          Backup Piece       2623   19-JUN-11          /sdb/opt/rman/rman/arch_level_0_GIS_20110619_2636_icmf959t_1_1
        4:修改歸檔腳本修改腳本,添加按日期產(chǎn)生文件夾,
        [Oracle@localhost rman]$ vi archback.sh

        # user env
        source ~/.bash_profile

        export BACK_DATE=`date +%Y%m%d`
        export BACKUP_PATH=/sdb/opt/rman

        echo `mkdir -p ${BACKUP_PATH}/archivelog/${BACK_DATE}`

        rman target / nocatalog msglog=$BACKUP_PATH/archivelog/${BACK_DATE}/arch_0_$BACK_DATE.log << EOF

        # need a user and tablespace to create catalog
        #connect catalog rman/rman@$Oracle_SID;

        # resync catalog with target
        #resync catalog;

        run{
        allocate channel c1 type disk;
        allocate channel c2 type disk;
        allocate channel c3 type disk;
        sql 'alter system archive log current';
        backup filesperset 3 format '$BACKUP_PATH/archivelog/${BACK_DATE}/arch_level_0_%d_%T_%s_%U' archivelog all delete input;
        release channel c1;
        release channel c2;
        release channel c3;
        }

        crosscheck backup;
        delete noprompt expired backup;
        crosscheck archivelog all;
        delete noprompt archivelog until time 'sysdate - 1'  all ;
        report obsolete;
        delete noprompt obsolete;

        exit

        EOF

        # end

        5:修改數(shù)據(jù)備份腳本[Oracle@localhost rman]$ vi fullback.sh

        # user env
        source ~/.bash_profile

        export BACK_DATE=`date +%Y%m%d`
        export BACKUP_PATH=/sdb/opt/rman

        echo `mkdir -p ${BACKUP_PATH}/rman/${BACK_DATE}`

        rman target / nocatalog msglog=$BACKUP_PATH/rman/${BACK_DATE}/bak_0_$BACK_DATE.log << EOF

        # need a user and tablespace to create catalog
        #connect catalog rman/rman@$Oracle_SID;

        # resync catalog with target
        #resync catalog;

        run{
        allocate channel c1 type disk;
        allocate channel c2 type disk;
        allocate channel c3 type disk;
        backup full database include current controlfile tag 'dbk_level_0' format '$BACKUP_PATH/rman/${BACK_DATE}/df_level_0_%d_%T_%s_%U';
        sql 'alter system archive log current';
        backup filesperset 3 format '$BACKUP_PATH/rman/${BACK_DATE}/arch_level_0_%d_%T_%s_%U' archivelog all delete input;
        release channel c1;
        release channel c2;
        release channel c3;
        }

        crosscheck backup;
        delete noprompt expired backup;
        crosscheck archivelog all;
        delete noprompt archivelog until time 'sysdate'  all ;
        report obsolete;
        delete noprompt obsolete;

        exit

        EOF
        6:修改Crontab任務(wù)修改如下,增加定時任務(wù)失敗日志:
        [Oracle@localhost monitor_client]$ crontab -l
        30 01 * * 0 "/usr/app/rman/fullback.sh" >/home/Oracle/monitor_client/logs/full_cron.log 2>/home/oracle/monitor_client/logs/full_cron_error.log
        00 00 * * 6,1,2,3,4,5 "/usr/app/rman/archback.sh" >/home/Oracle/monitor_client/logs/arch_cron.log 2>/home/oracle/monitor_client/logs/arch_cron_error.log
        30 7,15 * * * "/home/Oracle/monitor_client/client_cron.sh" >/home/oracle/monitor_client/client_cron.log 2>/home/oracle/monitor_client/client_cron_error.log
        7:郵件監(jiān)控腳本修改增加傳送定時任務(wù)錯誤腳本功能,服務(wù)器端接收到數(shù)據(jù)后解析郵件通知


         


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

        服務(wù)器租用/服務(wù)器托管中國五強(qiáng)!虛擬主機(jī)域名注冊頂級提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]

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

        0371-60135900
        7*24小時客服服務(wù)熱線