zoukankan      html  css  js  c++  java
  • 【DATAGUARD】物理dg配置客户端无缝切换 (八.4)--ora-16652 和 ora-16603错误

    DATAGUARD】物理dg配置客户端无缝切换 (.4)--ora-16652 ora-16603错误

    一.1  BLOG文档结构图

     

    wps9928.tmp 

     

    一.2  前言部分

     

    一.2.1  导读

    各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~:

     Data Guard Broker 的配置

    Fast-Start Failover 的配置

    Oracle DataGuard 之客户端TAF 配置

    ④ 使用DGMGRL 来管理数据库

     物理dg管理和维护的一些sql

    ⑥ DataGuard 客户端特级配置

     

    注意:本篇BLOG中代码部分需要特别关注的地方我都用黄色背景和红色字体来表示,比如下边的例子中,thread 1的最大归档日志号为33thread 2的最大归档日志号为43是需要特别关注的地方。

      List of Archived Logs in backup set 11

      Thrd Seq     Low SCN    Low Time            Next SCN   Next Time

      ---- ------- ---------- ------------------- ---------- ---------

      1    32      1621589    2015-05-29 11:09:52 1625242    2015-05-29 11:15:48

      1    33      1625242    2015-05-29 11:15:48 1625293    2015-05-29 11:15:58

      2    42      1613951    2015-05-29 10:41:18 1625245    2015-05-29 11:15:49

      2    43      1625245    2015-05-29 11:15:49 1625253    2015-05-29 11:15:53

     

     

     

     

     

    本文如有错误或不完善的地方请大家多多指正,ITPUB留言或QQ皆可,您的批评指正是我写作的最大动力。

    一.2.2  实验环境介绍

     

     项目

    主库

    dg

    db 类型

    单实例

    单实例

    db version

    11.2.0.3

    11.2.0.3

    db 存储

    FS type

    FS type

    ORACLE_SID

    oradg11g

    oradgphy

    db_name

    oradg11g

    oradg11g

    主机IP地址:

    192.168.59.130

    192.168.59.130

    OS版本及kernel版本

    RHEL6.5 64位,2.6.32-504.16.2.el6.x86_64

    RHEL6.5 64位,2.6.32-504.16.2.el6.x86_64

    OS hostname

    rhel6_lhr

    rhel6_lhr

     

     

     

    一.2.3  相关参考文章链接

     

    dg的系列文章参考:

    【DATAGUARD】 基于同一个主机建立物理备库和逻辑备库(一): http://blog.itpub.net/26736162/viewspace-1448197/
    【DATAGUARD】 基于同一个主机建立物理备库和逻辑备库(二 ):  http://blog.itpub.net/26736162/viewspace-1448207/
    【DATAGUARD】 基于同一个主机建立物理备库和逻辑备库(三 ):  http://blog.itpub.net/26736162/viewspace-1481972/
    【DATAGUARD】 基于同一个主机建立物理备库和逻辑备库 (四)--添加一个物理dg节点 :http://blog.itpub.net/26736162/viewspace-1484878/

    【DATAGUARD】物理dg的switchover切换(五) http://blog.itpub.net/26736162/viewspace-1753111/

    【DATAGUARD】物理dg的failover切换(六)   http://blog.itpub.net/26736162/viewspace-1753130/

    【DATAGUARD】物理dg在主库丢失归档文件的情况下的恢复(七)  http://blog.itpub.net/26736162/viewspace-1780863/

    DATAGUARD】物理dg配置客户端无缝切换 (八.1)--Data Guard Broker 的配置:http://blog.itpub.net/26736162/viewspace-1811839/

    【DATAGUARD】物理dg配置客户端无缝切换 (八.2)--Fast-Start Failover 的配置http://blog.itpub.net/26736162/viewspace-1811936/

    【DATAGUARD】物理dg配置客户端无缝切换 (八.3)--客户端TAF 配置http://blog.itpub.net/26736162/viewspace-1811944/

    【DATAGUARD】物理dg配置客户端无缝切换 (八.4)--ora-16652 和 ora-16603错误 :http://blog.itpub.net/26736162/viewspace-1811947/

     

     

     

     

    一.2.4  本文简介

     

    本篇blog是基于cuug的公开课内容,我自己进行实践的操作,视频可以参考:http://blog.itpub.net/26736162/viewspace-1624453/ ,简介我就不多写了,把cuug的内容直接copy过来吧,觉得还是比较有用的。

     

    这个技术如果你不知道,不能算是ORACLE高手

    这个技术如果你不知道,就不能说你会DataGuard

    这个技术如果你不知道,......

     

    本次网络课程,研究当主备库发生切换时,如何在主库启动一个service,保证客户端的连接能够继续,而且还能够继续select查询操作,而不管主备库是在哪台服务器上;同时保证新的客户连接没有任何的问题。本课程网络上的例子不多,陈老师花了将近一年的时间人肉搜索,最近才找到,急不可待的要分享给大家。

     

    1DataGuard的配置(快速)

    2、创建service

    3、创建触发器

    4、主备库切换测试

     

    由于内容较多,我打算分为4个章节来共享给大家,贴个图,不要奇怪,还有一个章节是实验过程中配到的问题解决。

    wps9938.tmp 

     

    本篇为第四节,列举了2个错误

     

     

     

    一.3  实验部分

     

    一.3.1  实验目标

     

    可以解决ORA-16603 ORA-16652错误。

    一.3.2  错误: ORA-16603: Data Guard 中介在配置 ID 中检测到不匹配

    DGMGRL> reinstate database   oradg11g;

    正在恢复数据库 "oradg11g", 请稍候...

    错误: ORA-16603: Data Guard 中介在配置 ID 中检测到不匹配

     

    失败。

    恢复数据库 "oradg11g" 失败

     

    DGMGRL> remove configuration;

    错误: ORA-16603: Data Guard 中介在配置 ID 中检测到不匹配

    错误: ORA-16625: 无法访问数据库 "oradgphy"

     

    失败。

     

     

    DGMGRL> show database verbose oradgphy

     

    数据库 - oradgphy

     

      角色:            PRIMARY

      预期状态:        OFFLINE

      实例:

        oradgphy

     

      属性:

        DGConnectIdentifier             = 'tns_oradgphy_dgmgrl'

        ObserverConnectIdentifier       = ''

        LogXptMode                      = 'ASYNC'

        DelayMins                       = '0'

        Binding                         = 'optional'

        MaxFailure                      = '0'

        MaxConnections                  = '1'

        ReopenSecs                      = '300'

        NetTimeout                      = '30'

        RedoCompression                 = 'DISABLE'

        LogShipping                     = 'ON'

        PreferredApplyInstance          = ''

        ApplyInstanceTimeout            = '0'

        ApplyParallel                   = 'AUTO'

        StandbyFileManagement           = 'AUTO'

        ArchiveLagTarget                = '0'

        LogArchiveMaxProcesses          = '4'

        LogArchiveMinSucceedDest        = '1'

        DbFileNameConvert               = 'oradg11g, oradgphy'

        LogFileNameConvert              = 'oradg11g, oradgphy'

        FastStartFailoverTarget         = ''

        InconsistentProperties          = '(monitor)'

        InconsistentLogXptProps         = '(monitor)'

        SendQEntries                    = '(monitor)'

        LogXptStatus                    = '(monitor)'

        RecvQEntries                    = '(monitor)'

        SidName                         = 'oradgphy'

        StaticConnectIdentifier         = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rhel6_lhr)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=oradgphy_DGMGRL.lhr.com)(INSTANCE_NAME=oradgphy)(SERVER=DEDICATED)))'

        StandbyArchiveLocation          = 'USE_DB_RECOVERY_FILE_DEST'

        AlternateLocation               = ''

        LogArchiveTrace                 = '0'

        LogArchiveFormat                = '%t_%s_%r.dbf'

        TopWaitEvents                   = '(monitor)'

     

    数据库状态:

    DISABLED

     

    DGMGRL> show database verbose oradg11g

     

    数据库 - oradg11g

     

      角色:            PHYSICAL STANDBY

      预期状态:        OFFLINE

      传输滞后:        (未知)

      应用滞后:        (未知)

      实时查询:        OFF

      实例:

        oradg11g

     

      属性:

        DGConnectIdentifier             = 'tns_oradg11g_dgmgrl'

        ObserverConnectIdentifier       = ''

        LogXptMode                      = 'ASYNC'

        DelayMins                       = '0'

        Binding                         = 'optional'

        MaxFailure                      = '0'

        MaxConnections                  = '1'

        ReopenSecs                      = '300'

        NetTimeout                      = '30'

        RedoCompression                 = 'DISABLE'

        LogShipping                     = 'ON'

        PreferredApplyInstance          = ''

        ApplyInstanceTimeout            = '0'

        ApplyParallel                   = 'AUTO'

        StandbyFileManagement           = 'AUTO'

        ArchiveLagTarget                = '0'

        LogArchiveMaxProcesses          = '4'

        LogArchiveMinSucceedDest        = '1'

        DbFileNameConvert               = 'oradgphy, oradg11g'

        LogFileNameConvert              = 'oradgphy, oradg11g'

        FastStartFailoverTarget         = ''

        InconsistentProperties          = '(monitor)'

        InconsistentLogXptProps         = '(monitor)'

        SendQEntries                    = '(monitor)'

        LogXptStatus                    = '(monitor)'

        RecvQEntries                    = '(monitor)'

        SidName                         = 'oradg11g'

        StaticConnectIdentifier         = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rhel6_lhr)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=oradg11g_DGMGRL.lhr.com)(INSTANCE_NAME=oradg11g)(SERVER=DEDICATED)))'

        StandbyArchiveLocation          = 'USE_DB_RECOVERY_FILE_DEST'

        AlternateLocation               = ''

        LogArchiveTrace                 = '0'

        LogArchiveFormat                = '%t_%s_%r.dbf'

        TopWaitEvents                   = '(monitor)'

     

    数据库状态:

    DISABLED

     

    DGMGRL> show configuration

     

    配置 - fsf_oradg11g_lhr

     

      保护模式:        MaxPerformance

      数据库:

        oradgphy - 主数据库

        oradg11g - 物理备用数据库

     

    快速启动故障转移: DISABLED

     

    配置状态:

    DISABLED

     

    DGMGRL> enable configuration

    已启用。

    DGMGRL> show configuration

     

    配置 - fsf_oradg11g_lhr

     

      保护模式:        MaxPerformance

      数据库:

        oradgphy - 主数据库

        oradg11g - 物理备用数据库 (禁用)

     

    快速启动故障转移: DISABLED

     

    配置状态:

    SUCCESS

     

     

     

    解决办法:

    主备库都执行:

    ①  alter system set DG_BROKER_START=false;

    ② 删除如下的文件

    14:45:50 SQL> show parameter DG_BROKER_CONFIG

     

    NAME                                 TYPE        VALUE

    ------------------------------------ ----------- ------------------------------

    dg_broker_config_file1               string      /u01/app/oracle/product/11.2.0

                                                     /dbhome_1/dbs/dr1oradgphy.dat

    dg_broker_config_file2               string      /u01/app/oracle/product/11.2.0

                                                     /dbhome_1/dbs/dr2oradgphy.dat

     

    ①  alter system set DG_BROKER_START=true;

     

    [oracle@rhel6_lhr admin]$ oerr ora 16603

    16603, 00000, "Data Guard broker detected a mismatch in configuration ID"

    // *Cause:  There was a mismatch in configuration unique ID. This could occur

    //          if the original configuration was re-created while this database

    //          was disconnected from the network or the same database was added

    //          to two different Data Guard broker configurations.

    // *Action: Make sure the database belongs to only one broker configuration.

    //          Shut down the broker by setting the DG_BROKER_START initialization

    //          parameter to false. Then remove the Data Guard broker configuration

    //          files. Finally restart the broker by setting the DG_BROKER_START

    //          initialization parameter to true.

     

    [oracle@rhel6_lhr admin]$ ll  /u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr*

    -rw-r----- 1 oracle asmadmin 16384 Sep 28 12:11 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr1oradg11g.dat

    -rw-r----- 1 oracle asmadmin 16384 Sep 28 14:47 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr1oradgphy.dat

    -rw-r----- 1 oracle asmadmin 16384 Sep 28 12:10 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr2oradg11g.dat

    -rw-r----- 1 oracle asmadmin 16384 Sep 28 14:47 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr2oradgphy.dat

    [oracle@rhel6_lhr admin]$ rm -rf   /u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr*

     

    [oracle@rhel6_lhr ~]$ dgmgrl sys/lhr@tns_oradgphy_dgmgrl

    DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production

     

    Copyright (c) 2000, 2009, Oracle. All rights reserved.

     

    欢迎使用 DGMGRL, 要获取有关信息请键入 "help"。

    已连接。

    DGMGRL> show configuration;

    ORA-16532: Data Guard 中介配置不存在

     

    配置详细资料不能由 DGMGRL 确定

    DGMGRL>

    DGMGRL>

    DGMGRL> create configuration 'fsf_oradg11g_lhr' as

    > primary database is 'oradgphy'

    > connect identifier is tns_oradgphy_dgmgrl;

     

    add database 'oradg11g' as

    connect identifier is tns_oradg11g_dgmgrl

    maintained as physical;

     

    已创建配置 "fsf_oradg11g_lhr", 其中主数据库为 "oradgphy"

    DGMGRL> DGMGRL> > > 已添加数据库 "oradg11g"

    DGMGRL> DGMGRL>

    DGMGRL>

    DGMGRL>

    DGMGRL>

    DGMGRL>

    DGMGRL>

    DGMGRL>

    DGMGRL>  show configuration

     

    配置 - fsf_oradg11g_lhr

     

      保护模式:        MaxPerformance

      数据库:

        oradgphy - 主数据库

        oradg11g - 物理备用数据库

     

    快速启动故障转移: DISABLED

     

    配置状态:

    DISABLED

     

    DGMGRL> enable configuration

    已启用。

    DGMGRL>  show configuration

     

    配置 - fsf_oradg11g_lhr

     

      保护模式:        MaxPerformance

      数据库:

        oradgphy - 主数据库

        oradg11g - 物理备用数据库

     

    快速启动故障转移: DISABLED

     

    配置状态:

    SUCCESS

     

    DGMGRL> switchover to oradg11g

    立即执行切换, 请稍候...

    新的主数据库 "oradg11g" 正在打开...

    操作要求关闭实例 "oradgphy" (在数据库 "oradgphy" 上)

    正在关闭实例 "oradgphy"...

    ORACLE 例程已经关闭。

    操作要求启动实例 "oradgphy" (在数据库 "oradgphy" 上)

    正在启动实例 "oradgphy"...

    ORACLE 例程已经启动。

    数据库装载完毕。

    数据库已经打开。

    切换成功, 新的主数据库为 "oradg11g"

    DGMGRL> show configuration

     

    配置 - fsf_oradg11g_lhr

     

      保护模式:        MaxPerformance

      数据库:

        oradg11g - 主数据库

        oradgphy - 物理备用数据库

     

    快速启动故障转移: DISABLED

     

    配置状态:

    SUCCESS

     

    DGMGRL>

     

     

    一.3.3  ORA-16652: 已禁用快速启动故障转移目标备用数据库

    [oracle@rhel6_lhr lhr]$ dgmgrl sys/lhr@tns_oradg11g_dgmgrl

    DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production

     

    Copyright (c) 2000, 2009, Oracle. All rights reserved.

     

    欢迎使用 DGMGRL, 要获取有关信息请键入 "help"。

    已连接。

    DGMGRL> disable  fast_start failover

    错误: ORA-16652: 已禁用快速启动故障转移目标备用数据库

     

    失败。

    DGMGRL>  reinstate database oradgphy;

    正在恢复数据库 "oradgphy", 请稍候...

    已成功恢复数据库 "oradgphy"

     

    DGMGRL> show configuration

     

    配置 - fsf_oradg11g_lhr

     

      保护模式:        MaxAvailability

      数据库:

        oradg11g - 主数据库

        oradgphy - (*) 物理备用数据库

     

    快速启动故障转移: ENABLED

     

    配置状态:

    SUCCESS

     

    DGMGRL>

     

    如果报错,那么就重新启动需要恢复的数据库,然后重新执行reinstate database oradgphy;

    DGMGRL> show configuration

     

    配置 - fsf_oradg11g_lhr

     

      保护模式:        MaxAvailability

      数据库:

        oradgphy - 主数据库

          警告: ORA-16817: 快速启动故障转移配置不同步

     

        oradg11g - (*) 物理备用数据库 (禁用)

          ORA-16661: 需要恢复备用数据库

     

    快速启动故障转移: ENABLED

     

    配置状态:

    WARNING

     

    DGMGRL>  reinstate database oradg11g;

    正在恢复数据库 "oradg11g", 请稍候...

    已成功恢复数据库 "oradg11g"

    DGMGRL> show configuration

     

    配置 - fsf_oradg11g_lhr

     

      保护模式:        MaxAvailability

      数据库:

        oradgphy - 主数据库

        oradg11g - (*) 物理备用数据库

     

    快速启动故障转移: ENABLED

     

    配置状态:

    SUCCESS

     

    DGMGRL>

     

     

     

     

    一.4  About Me

     

    ...........................................................................................................................................................................................

    本文作者:小麦苗,只专注于数据库的技术,更注重技术的运用

    ITPUB BLOG:http://blog.itpub.net/26736162

    本文地址:http://blog.itpub.net/26736162/viewspace-1811947/

    本文pdf版:http://yunpan.cn/cdEQedhCs2kFz (提取码:ed9b)

    QQ:642808185 若加QQ请注明你所正在读的文章标题

    创作时间地点:2015-09-28 09:00~ 2015-09-29 23:00 于外汇交易中心完成

    <版权所有,文章允许转载,但须以链接方式注明源地址,否则追究法律责任!>

    ...........................................................................................................................................................................................

     

     

  • 相关阅读:
    Leetcode 3:无重复字符的最长子串
    激光三角测量法在工业视觉检测上的应用
    通俗易懂的Harris 角点检测
    杂乱场景中的尺度层次三维目标识别
    多视图几何三维重建实战系列之R-MVSNet
    一文详解工业相机和镜头选取
    LOAM论文介绍与A-LOAM代码简介
    基于双目事件相机的视觉里程计
    在医学图像分析中使用ICP算法进行点云配准
    两种ICP的改进算法:PLICP与NICP
  • 原文地址:https://www.cnblogs.com/lhrbest/p/4847348.html
Copyright © 2011-2022 走看看