zoukankan      html  css  js  c++  java
  • oracle rman 备份数据库常用脚本


    $ vi vi bk_db_full.sh

    ORACLE_BASE=/u01/app/oracle
    ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
    ORACLE_SID=orcl
    NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
    PATH=$PATH:/ORACLE_HOME/bin
    ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
    PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$ORACLE_HOME/opatch
    CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
    CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib

    export ORA_NLS33

    export ORACLE_BASE ORACLE_HOME ORACLE_SID 

    export DB_NAME NLS_LANG PATH LD_LIBRARY_PATH CLASSPATH DB_NAME 

    rman target=/ cmdfile=/u03/rman/rman_script/bk_db_full.rman log=/u03/rman/rman_log/bk_db_full_`date +%Y%m%d%H%M%S`.log



    $ vi bk_db_full.rman

    run
    {
            ALLOCATE CHANNEL CH1 DEVICE TYPE DISK MAXPIECESIZE=20000M ; 
            sql 'ALTER SYSTEM CHECKPOINT';
            backup as compressed backupset incremental level 0 cumulative database include current controlfile 
            format '/mnt/backup/DB_%d_%U_%T.BKP';  
            RELEASE CHANNEL CH1; 
    }

    run
    {       
            ALLOCATE CHANNEL CH1 DEVICE TYPE DISK MAXPIECESIZE=8000M ; 
            sql 'ALTER SYSTEM CHECKPOINT';
            sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
            sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
            backup as compressed backupset archivelog all delete input 
            format '/mnt/backup/ARCH_%d_%U_%T.BKP';
            RELEASE CHANNEL CH1;
    }

    run
    {
            ALLOCATE CHANNEL CH1 DEVICE TYPE DISK MAXPIECESIZE=8000M;
            backup current controlfile format '/mnt/backup/CTL_%d_%U_%T.BKP';
            RELEASE CHANNEL CH1;
    }

    crosscheck backup;
    crosscheck archivelog all;
    delete noprompt expired backup;
    delete expired archivelog all;
    delete force noprompt obsolete recovery window of 15 days;

    list backup;
    exit;

  • 相关阅读:
    内存泄漏检测工具
    RGB 颜色 代码 转换器
    索引 扫描及查找 1
    IIS7中Integrated和classic的区别
    HTTP请求上下文之终结:HttpContext类
    vs2010 快捷键大全
    IIS 7.0 中的 HTTP 状态代码
    JSON Date Format
    如何使用 MasterPage(注意母板页和子页面的执行顺序)
    B树、B树、B+树、B*树
  • 原文地址:https://www.cnblogs.com/ctypyb2002/p/9793119.html
Copyright © 2011-2022 走看看