• 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级增量备份。

  • 相关阅读:
    .NET Core VS Code 环境配置
    系统架构正交分解法
    面向接口可扩展框架之“Mvc扩展框架及DI”
    发送和接收数据包
    Easticsearch通信方式_API
    Web Api集成Swagger
    NET MVC RazorEngine 解析模板生成静态页
    NET单元测试的艺术
    NET平台机器学习组件-Infer.NET
    ActiveMQ相关背景(转)
  • 原文地址:https://www.cnblogs.com/landexia/p/2634345.html
Copyright © 2020-2023  润新知