【DATAGUARD】物理dg配置客戶端無縫切換 (八.4)--ora-16652 和 ora-16603錯誤

Appleses發表於2016-01-30

DATAGUARD】物理dg配置客戶端無縫切換 (.4)--ora-16652 ora-16603錯誤

1.1  BLOG文件結構圖

 

wpsAB24.tmp 

 

1.2  前言部分

 

1.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皆可,您的批評指正是我寫作的最大動力。

1.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

 

 

 

1.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/

 

 

 

 

 

1.2.4  本文簡介

 

本篇blog是基於cuug的公開課內容,我自己進行實踐的操作,視訊可以參考:http://blog.itpub.net/26736162/viewspace-1624453/ ,簡介我就不多寫了,把cuug的內容直接copy過來吧,覺得還是比較有用的。

 

這個技術如果你不知道,不能算是ORACLE高手

這個技術如果你不知道,就不能說你會DataGuard

這個技術如果你不知道,......

 

本次網路課程,研究當主備庫發生切換時,如何在主庫啟動一個service,保證客戶端的連線能夠繼續,而且還能夠繼續select查詢操作,而不管主備庫是在哪臺伺服器上;同時保證新的客戶連線沒有任何的問題。本課程網路上的例子不多,陳老師花了將近一年的時間人肉搜尋,最近才找到,急不可待的要分享給大家。

 

1DataGuard的配置(快速)

2、建立service

3、建立觸發器

4、主備庫切換測試

 

由於內容較多,我打算分為4個章節來共享給大家,貼個圖,不要奇怪,還有一個章節是實驗過程中配到的問題解決。

wpsAB25.tmp 

 

本篇為第四節,列舉了2個錯誤

 

 

 

1.3  實驗部分

 

1.3.1  實驗目標

 

可以解決ORA-16603 ORA-16652錯誤。

1.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>

 

 

1.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>

 

 

 


 





About Me

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

● 本文作者:小麥苗,只專注於資料庫的技術,更注重技術的運用

● 本文在itpub(http://blog.itpub.net/26736162/abstract/1/)、部落格園(http://www.cnblogs.com/lhrbest)和個人微信公眾號(xiaomaimiaolhr)上有同步更新

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

● 本文部落格園地址:http://www.cnblogs.com/lhrbest

● 本文pdf版、個人簡介及小麥苗雲盤地址:http://blog.itpub.net/26736162/viewspace-1624453/

● 資料庫筆試面試題庫及解答:http://blog.itpub.net/26736162/viewspace-2134706/

● DBA寶典今日頭條號地址:http://www.toutiao.com/c/user/6401772890/#mid=1564638659405826

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

● QQ群號:230161599(滿)、618766405

● 微信群:可加我微信,我拉大家進群,非誠勿擾

● 聯絡我請加QQ好友646634621,註明新增緣由

● 於 2015-09-28 09:00~ 2015-09-29 23:00 在魔都完成

● 文章內容來源於小麥苗的學習筆記,部分整理自網路,若有侵權或不當之處還請諒解

● 版權所有,歡迎分享本文,轉載請保留出處

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

小麥苗的微店https://weidian.com/s/793741433?wfr=c&ifr=shopdetail

小麥苗出版的資料庫類叢書http://blog.itpub.net/26736162/viewspace-2142121/

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

使用微信客戶端掃描下面的二維碼來關注小麥苗的微信公眾號(xiaomaimiaolhr)及QQ群(DBA寶典),學習最實用的資料庫技術。

   小麥苗的微信公眾號      小麥苗的DBA寶典QQ群1     小麥苗的DBA寶典QQ群2        小麥苗的微店

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

【DATAGUARD】物理dg配置客戶端無縫切換 (八.4)--ora-16652 和 ora-16603錯誤
DBA筆試面試講解群1
DBA筆試面試講解群2
歡迎與我聯絡



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26736162/viewspace-1811947/,如需轉載,請註明出處,否則將追究法律責任。

相關文章