zoukankan      html  css  js  c++  java
  • RMAN 常用的备份脚本

    0级全库备份脚本

    $ vi BackupFull.sh

    BackupFull.sh文件的内容为:

    # script .:BackupFull.sh
    
    # creater:leon_lan
    
    # date:2012/7/22
    
    # desc: backup full database datafile in archive with rman
    
    # connect database
    
    Export ORACLE_BASE=/u01/app/oracle
    
    Export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
    
    Export ORACLE_SID=oms
    
    Export PATH=$ORACLE_HOME/bin:$PATH
    
    Rman target/ << EOF_RMAN
    
    Run{
    
           Allocate channel c1 type disk;
    
           Backup incremental level 0 tag ‘db0’ format
    
           ‘/u01/app/oracle/RmanBackup/db0_%d_%T_%s’ database include current controlfile;
    
           Delete noprompt obsolete;
    
           Release channel c1;
    
    }
    
    #end

    1级增量备份脚本

    $ vi Incr1.sh

    Incr1.sh文件的内容为:

    # script .:BackupFull.sh
    
    # creater:leon_lan
    
    # date:2012/7/22
    
    # desc: backup full database datafile in archive with rman
    
    # connect database
    
    Export ORACLE_BASE=/u01/app/oracle
    
    Export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
    
    Export ORACLE_SID=oms
    
    Export PATH=$ORACLE_HOME/bin:$PATH
    
    Rman target/ << EOF_RMAN
    
    Run{
    
           Allocate channel c1 type disk;
    
           Backup incremental level 1 tag ‘db1’ format
    
           ‘/u01/app/oracle/RmanBackup/db1_%d_%T_%s’ database include current controlfile;
    
           Delete noprompt obsolete;
    
           Release channel c1;
    
    }
    
    #end

    设置自动化执行备份脚本

    $ crontab –e
    
    0 1 * * 0 /u01/app/oracle/RmanBackup/BackupFull.sh
    
    >>/u01/app/oracle/RmanBackup/BackupFull.log
    
    0 1 * * 3 /u01/app/oracle/RmanBackup/BackupFull.sh
    
    >>/u01/app/oracle/RmanBackup/BackupFull.log
    
    30 1 * * 1-2 /u01/app/oracle/RmanBackup/Incr1.sh
    
    >>/u01/app/oracle/RmanBackup/Incr.log
    
    30 1 * * 4-6 /u01/app/oracle/RmanBackup/Incr1.sh
    
    >>/u01/app/oracle/RmanBackup/Incr.log

    上面的内容的意思是周日和周三凌晨1:00执行0级全库备份,周一、二、四、五六凌晨1:30执行1级增量备份。

  • 相关阅读:
    pyppeteer
    maven生命周期clean,compile,install,package区别
    centos7安装anyproxy
    安装jupyter notebook
    Linux-Centos7下安装Anaconda
    python文件 启动django项目
    PyCharm实用插件
    pyqt5 安装额外的工具
    PyQt5高级界面控件之QTableWidget的具体使用方法
    k8s Metrics Server 获取资源指标与 hpa 部署
  • 原文地址:https://www.cnblogs.com/landexia/p/2634345.html
Copyright © 2011-2022 走看看