DG(2)Flashing Back a Failed Primary Database into a Physical Standby Database

    如果Failover之后,整个Data Guard已不存在了,需要重建主备库关系,
即把原来的主库重建为当前库的Standby库。常规做法是重来一遍备份,拷贝,恢复等耗时操作。
    不过这里介绍的是利用Flashback Database来快速完成恢复。

前提Failover之前,在旧的Primary数据库上已开启过闪回.   
   a. alter system set db_recovery_file_dest_size=2g scope=both;
   b. alter sysetem set db_recovery_file_dest='/u01/app/oracle/oradata/xcldb/fra' scope=both;
   c. shutdown immediate;
   d. startup mount;
   e. alter database flashback on;
   f. alter database open;
   

Step 1 Determine the SCN which the old standby database became the primary database
       即得到Failover之后,新的主库的生成时的scn.
       SELECT to_char(standby_became_primary_scn) FROM v$database;
  
Step 2. Flash back the failed primary database.
    Shut down the old primary database(if necessary),mount it,and flash it back to the
    value for STANDBY_BECAME_PRIMARY_SCN that was determined in Step 1.
     在旧主库上,利用闪回库功能把旧的主库回滚到这个scn上
     2.1 关闭旧主库
         shutdown immediate;
     2.2 启动到mount状态,执行闪回
         startup mount;

         flashback database to scn xxx;  -- xxx 即查出来的standby_became_primary_scn的值


Step 3. Convert the database to a physical standby database.
        转换旧的primary为staneby状态
         3.1 Issue the following statement on the old primary database:
          alter database convert to physical staneby;
         3.2 Shut down and restart the database:
          shutdown immediate;

          startup mount;


Step 4. Start transporting redo to the new physical standby database.
         现在可以开始主备间同步了。
        4.1 重要,查询并确认归档参数设置是否正确. 因为以前是主库。现在要作为备库,要检查是否 要调整参数或Standby log之类是否有建。
                       SELECT dest_id,dest_name,status,protection_mode,destination,error,srl FROM V$ARCHIVE_DEST_STATUS;
        4.2 如没问题,将其激活
                      alter system set log_archive_dest_state_n=enable;

        4.3 通过在主库做日志切换,检查下日志配置是否生效。
        alter system switch logfile; 
        --如果切换后,发现standby库恢复操作中止,再执行一次同步命令就行了。
        SELECT dest_id,dest_name,status,protection_mode,destination,error,srl FROM V$ARCHIVE_DEST_STATUS;

Step 5 Start Redo Apply on the new physical standby database.
     开始数据同步

         alter database recover managed standby database using current logfile disconnect from session;


整理自Oracle官方文档.


MAIL:  xcl_168@aliyun.com

BLOG: http://blog.csdn.net/xcl168



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值