• 【Oracle 数据备份恢复】RMAN异机恢复


          源DB: 192.168.100.8
       目标DB: 192.168.100.2
             SID: UDB
      
    RMAN异机恢复步骤:
    【源DB】:
    (1)备份: 利用RMAN备份控制文件,全库和归档日志;

     run{ 

    allocate channel d1 type disk;
    allocate channel d2 type disk;
    allocate channel d3 type disk;
    allocate channel d4 type disk;
    crosscheck backup;
    crosscheck archivelog all;
    sql 'alter system archive log current';
    backup full database format '/backup/rman/dbf/full__%d_%s_%p_%u.bak';
    sql 'alter system archive log current';
    backup current controlfile format '/backup/rman/control/control_%s_%p_%t';
    crosscheck backup;
    delete noprompt expired backup;
    delete obsolete;
    configure retention policy TO REDUNDANCY 4;
    release channel d4;
    release channel d3;
    release channel d2;
    release channel d1;
    }

     run{ 

    allocate channel d1 type disk;
    allocate channel d2 type disk;
    sql 'alter system archive log current';
    backup archivelog all format '/backup/rman/archivelog/archive_%t_%s' delete all input;
    crosscheck archivelog all;
    release channel d1;
    release channel d2;
    }

    (2)检查: 检查备份的控制文件,数据文件和归档日志是否有效,时间上保持一致;

    ls -lt full.* control.* archive.*  查看时间

    (3)拷贝: 将备份集拷贝到目标DB目录

    scp * oracle@192.168.100.2:/orashare/rman/

    【目标DB】:
    (1)创建目录:       根据源DB的目录结构,建立相关目录.

    $ORACLE_BASE/admin/$ORACLE_SID/{adump,dpdump,pfile}
    $ORACLE_BASE/oradata
    $ORACLE_BASE/diag
    RMAN备份的恢复目录

    (2)注册备份集:    将拷贝过来的RMAN备份集注册到本机的控制文件里面去

    RMAN> catalog backuppiece ''/backup/demo_40.dbf'' 注册备份片;
    RMAN> catalog start with ''/bak''                                 注册特定目录的所有备份文件;
    (3)创建密码文件: 认证的密码文件

    cd $ORACLE_HOME/bin
    orapwd file=$ORACLE_HOME/dbs/orapworcl password=oracle entries=8
    cd $ORACLE_HOME/dbs

    (4)恢复参数文件: 设置ORACLE_SID环境变量,设置DBID,在nomount状态下,恢复参数文件

    startup nomount;
    export ORACLE_SID=udb
    set dbid=123456789
    restore spfile to pfile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initdave2.ora' from '/u01/backup/dave_spfile_16m6qtde_1_1_20110309';

    (5)恢复控制文件: 设置ORACLE_SID环境变量,设置DBID,在nomount状态下,恢复控制文件

    startup nomount;
    export ORACLE_SID=udb
    set dbid=123456789
    restore controlfile from '/u01/backup/ctl_file_15m6qtdc_1_1_20110309';

    (6)恢复数据文件: 设置ORACLE_SID环境变量,设置DBID,在mount  状态下,恢复数据文件;

    alter database mount;
    restore database;
    recover database;

    (7)打开数据库:   打开数据库修改实例名和DBID

    (8)检查数据是否恢复正常

     

  • 相关阅读:
    angular $apply()以及$digest()讲解1
    AngularJs + Bootstrap
    angular service讲解
    末班方法代码实战和总结
    JS基础学习1——什么是基础js类和原型?
    背景图片background-size兼容ie8以下浏览器解决
    magento2 客户端模式less样式修改。
    git贡献代码流程
    React模板
    获取iframe src中参数
  • 原文地址:https://www.cnblogs.com/tango-dg/p/3829125.html
Copyright © 2020-2023  润新知