zoukankan      html  css  js  c++  java
  • DGbroker快速失败转移

    1.先决条件

    DGMGRL>  ENABLE FAST_START FAILOVER;
    Error: ORA-16651: requirements not met for enabling fast-start failover
    [oracle@vijay02 ~]$ oerr ora 16651
    16651, 0000, "requirements not met for enabling fast-start failover"
    // *Cause:  The attempt to enable fast-start failover could not be completed
    //          because one or more requirements were not met:
    //          - The Data Guard configuration must be in either MaxAvailability
    //            or MaxPerformance protection mode.
    //          - The LogXptMode property for both the primary database and
    //            the fast-start failover target standby database must be
    //            set to SYNC if the configuration protection mode is set to
    //            MaxAvailability mode.
    //          - The LogXptMode property for both the primary database and
    //            the fast-start failover target standby database must be
    //            set to ASYNC if the configuration protection mode is set to
    //            MaxPerformance mode.
    //          - The primary database and the fast-start failover target standby
    //            database must both have flashback enabled.
    //          - No valid target standby database was specified in the primary
    //            database FastStartFailoverTarget property prior to the attempt
    //            to enable fast-start failover, and more than one standby
    //            database exists in the Data Guard configuration.
    // *Action: Retry the command after correcting the issue:
    //          - Set the Data Guard configuration to either MaxAvailability
    //            or MaxPerformance protection mode.
    //          - Ensure that the LogXptMode property for both the primary
    //            database and the fast-start failover target standby database
    //            are set to SYNC if the configuration protection mode is set to
    //            MaxAvailability.
    //          - Ensure that the LogXptMode property for both the primary
    //            database and the fast-start failover target standby database
    //            are set to ASYNC if the configuration protection mode is set to
    //            MaxPerformance.
    //          - Ensure that both the primary database and the fast-start failover
    //            target standby database have flashback enabled.
    //          - Set the primary database FastStartFailoverTarget property to
    //            the DB_UNIQUE_NAME value of the desired target standby database
    //            and the desired target standby database FastStartFailoverTarget
    //            property to the DB_UNIQUE_NAME value of the primary database.

    2.设置参数

      a.设置日志同步传输模式

    edit database patest set property logxptmode=sync;
    edit database satest set property logxptmode=sync;

      b.设置保护模式(MaxAvailability or MaxPerformance)

    edit configuration set protection mode as maxavailability;

      c.设置主库故障的转移对象

    edit database patest set property FastStartFailoverTarget='satest';
    edit database satest set property FastStartFailoverTarget='patest';

      d.主备库设置闪回

    3.启用FAST_START FAILOVER

    ENABLE FAST_START FAILOVER;

    查看状态

    DGMGRL> show configuration;
    
    Configuration - dgc
    
      Protection Mode: MaxAvailability
      Databases:
        patest - Primary database
          Warning: ORA-16819: fast-start failover observer not started
    
        satest - (*) Physical standby database
          Warning: ORA-16819: fast-start failover observer not started
    
    Fast-Start Failover: ENABLED    --已开启
    
    Configuration Status:
    WARNING

    因为没有开启监听器,所以出现警告。

    4.开启监听器(监听器可以设置在独立的服务器上,也可以设置为某个节点上,本问设置在节点备库上)

    (如果设置在独立的服务器上,要求服务器设置静态监听,和oracle软件)

    DGMGRL> START OBSERVER
    Observer started
    .......

    以上是开启监听器的命令,监听器开启后,界面无法返回。

    以下是dgmgrl状态信息

    DGMGRL> show configuration;
    
    Configuration - dgc
    
      Protection Mode: MaxAvailability
      Databases:
        patest - Primary database
        satest - (*) Physical standby database
    
    Fast-Start Failover: ENABLED    --已开启,没有警告信息,配置文件状态为SUCCUSS
    
    Configuration Status:
    SUCCESS

    5.模拟自动故障转移

      a.假设主库故障(shutdown abort)

      b监听器提示

    DGMGRL> START OBSERVER
    Observer started
    
    23:42:16.05  Wednesday, December 30, 2015
    Initiating Fast-Start Failover to database "satest"...
    Performing failover NOW, please wait...
    Failover succeeded, new primary is "satest"
    23:42:19.50  Wednesday, December 30, 2015

      以上提示,已自动启用备库为主库

      c.dgmgrl状态信息

    DGMGRL> show configuration;
    
    Configuration - dgc
    
      Protection Mode: MaxAvailability
      Databases:
        satest - Primary database
          Warning: ORA-16817: unsynchronized fast-start failover configuration
    
        patest - (*) Physical standby database (disabled)
          ORA-16661: the standby database needs to be reinstated
    
    Fast-Start Failover: ENABLED
    
    Configuration Status:
    WARNING

      d.尝试修复故障库,把故障库启动到mount状态

      e.监听器自动开始修复故障库

    DGMGRL> START OBSERVER
    Observer started
    
    23:42:16.05  Wednesday, December 30, 2015
    Initiating Fast-Start Failover to database "satest"...
    Performing failover NOW, please wait...
    Failover succeeded, new primary is "satest"
    23:42:19.50  Wednesday, December 30, 2015
    
    23:46:02.03  Wednesday, December 30, 2015
    Initiating reinstatement for database "patest"...
    Reinstating database "patest", please wait...
    Operation requires shutdown of instance "atest" on database "patest"
    Shutting down instance "atest"...
    Unable to connect to database
    ORA-12545: Connect failed because target host or object does not exist
    
    Failed.
    Warning: You are no longer connected to ORACLE.
    
    Please complete the following steps and reissue the REINSTATE command:
        shut down instance "atest" of database "patest"
        start up and mount instance "atest" of database "patest"
    
    23:46:20.82  Wednesday, December 30, 2015

      f.根据监听器提示重启故障库至mount

      g.查看dgmgrl状态信息

    DGMGRL> show configuration;
    
    Configuration - dgc
    
      Protection Mode: MaxAvailability
      Databases:
        satest - Primary database
          Warning: ORA-16817: unsynchronized fast-start failover configuration
    
        patest - (*) Physical standby database (disabled)
          ORA-16661: the standby database needs to be reinstated
    
    Fast-Start Failover: ENABLED
    
    Configuration Status:
    WARNING

      h.reinstate故障库

    DGMGRL> reinstate database patest;
    Reinstating database "patest", please wait...
    Reinstatement of database "patest" succeeded

      i.查看dgmgrl状态信息

    DGMGRL> reinstate database patest;
    Reinstating database "patest", please wait...
    Reinstatement of database "patest" succeeded
    DGMGRL> show configuration;
    
    Configuration - dgc
    
      Protection Mode: MaxAvailability
      Databases:
        satest - Primary database
        patest - (*) Physical standby database
    
    Fast-Start Failover: ENABLED
    
    Configuration Status:
    SUCCESS

    状态已恢复。

    6.关闭自动故障转移

    DGMGRL> stop observer
    Done.
    DGMGRL> disable fast_start failover;
    Disabled.

    查看dgmgrl状态信息

    DGMGRL> show configuration;
    
    Configuration - dgc
    
      Protection Mode: MaxAvailability
      Databases:
        satest - Primary database
        patest - Physical standby database
    
    Fast-Start Failover: DISABLED    --已禁用
    
    Configuration Status:
    SUCCESS

     7.小结:

    快速故障转移可能会导致数据丢失,慎用!

    监听器最好设置在独立的服务器上!

  • 相关阅读:
    python_day11 mysql
    python_day10 多线程 协程 IO模型
    python_day09 多进程 多线程 协程 paramiko模块
    python_day08 接口与归一化设计 多态与多态性 封装 面向对象高级 异常处理 网络编程
    python_day07 常用模块xml/configparser/hashlib/subprocess 面向对象程序设计
    python_day06 匿名函数与内置函数 常用模块
    python_day05 协程函数 面向过程编程 递归和二分法 模块和包的使用 常用模块 开发代码规范
    python_day04 函数嵌套 名称空间和作用域 闭包 装饰器 迭代器 生成器 列表解析 三元表达式 生成器表达式
    python_day03 文件处理复习和函数定义调用参数对象
    python_day02 基本数据类型操作,字符编码,文件处理
  • 原文地址:https://www.cnblogs.com/vijayfly/p/5090444.html
Copyright © 2011-2022 走看看