使用GI Agent(XAG)實現GoldenGate的高可用性(二)

hooca發表於2016-07-08
OS:Oracle Linux 6.6 x64,Windows Server 2008 R2 x64
DB:Oracle 12.1.2.0

參考:使用GI Agent(XAG)實現GoldenGate的高可用性(一) 

一、XAG
從11.2.0.3以後,XAG作為GI安裝的一部分,無需額外安裝。但XAG的新版本需獨立安裝。
綜上,建議安裝新版本XAG。
下載頁:http://oracle.com/goto/clusterware

解壓到任意目錄,在其中一個節點以grid使用者執行安裝:

點選(此處)摺疊或開啟

  1. ./xagsetup.sh --install --directory /u01/xag_v7 --all_nodes
  2. Installing Oracle Grid Infrastructure Agents on: node1
  3. Installing Oracle Grid Infrastructure Agents on: node2
  4. Done.
在所有節點為grid設定環境變數XAG_HOME,並把$XAG_HOM/binE加入PATH,置於$ORACLE_HOME/bin之前。

可以確認XAG版本:

點選(此處)摺疊或開啟

  1. $ agctl query releaseversion
  2. The Oracle Grid Infrastructure Agents release version is 7.1.0

二、ACFS
詳見:12c ASM中建立ACFS 

三、安裝GoldenGate
在ACFS上安裝GoldenGate。只需在一個節點上操作。安裝完成後在所有節點配置相關變數。

四、配置GoldenGate的VIP和Agent

首先,以root使用者新建一個VIP

點選(此處)摺疊或開啟

  1. /u01/app/12.1.0/grid/bin/appvipcfg create \
  2. -network=1 \
  3. -ip=192.168.6.99 \
  4. -vipname=xag.ggs_1-vip.vip \
  5. -user=oracle
以root使用者執行,使oracle使用者能夠管理VIP。

點選(此處)摺疊或開啟

  1. /u01/app/12.1.0/grid/bin/crsctl setperm resource xag.ggs_1-vip.vip -u user:oracle:r-x
接下來可以用oracle使用者啟動VIP:

點選(此處)摺疊或開啟

  1. /u01/app/12.1.0/grid/bin/crsctl start resource xag.ggs_1-vip.vip
檢視結果:

點選(此處)摺疊或開啟

  1. /u01/app/12.1.0/grid/bin/crsctl status resource xag.ggs_1-vip.vip
  2. NAME=xag.ggs_1-vip.vip
  3. TYPE=app.appvipx.type
  4. TARGET=ONLINE
  5. STATE=ONLINE on node2
建立GoldenGate的Agent,以GoldenGate的所有者oracle使用者執行:

點選(此處)摺疊或開啟

  1. $XAG_HOME/bin/agctl add goldengate ggs_1 \
  2. --gg_home /u01/ggs_1 \
  3. --instance_type source \
  4. --nodes node1,node2 \
  5. --vip_name xag.ggs_1-vip.vip \
  6. --filesystems ora.acfs1.acfs1.acfs \
  7. --databases ora.racdb.db \
  8. --oracle_home /u01/app/oracle/product/12.1.0/db_1 \
  9. --monitor_extracts ext1,pmp1
注意databases引數的寫法。

接下來檢視資源:

點選(此處)摺疊或開啟

  1. crsctl status resource xag.ggs_1.goldengate -f
五、配置GoldenGate
參考:12c多租戶架構下部署GoldenGate 12c 

六、測試

當前狀態

點選(此處)摺疊或開啟

  1. crsctl stat res -t

  2. xag.ggs_1-vip.vip
  3.       1 ONLINE ONLINE node2 STABLE
  4. xag.ggs_1.goldengate
  5.       1 ONLINE ONLINE node2 STABLE
嘗試切換到node1

點選(此處)摺疊或開啟

  1. agctl relocate goldengate ggs_1 --node node1
當前狀態變為:

點選(此處)摺疊或開啟

  1. xag.ggs_1-vip.vip
  2.       1 ONLINE ONLINE node1 STABLE
  3. xag.ggs_1.goldengate
  4.       1 ONLINE ONLINE node1 STABLE
同時也要登入ggsci,確認GoldenGate程式狀態:

點選(此處)摺疊或開啟

  1. > info all

  2. Program Status Group Lag at Chkpt Time Since Chkpt

  3. MANAGER RUNNING
  4. EXTRACT RUNNING EXT1 00:02:34 00:00:02
  5. EXTRACT RUNNING PMP1 00:00:00 00:00:10
如果是意外中斷一個節點(斷電),GoldenGate在另一節點上的恢復並不理想。具體表現為:

1)Manager, Extract程式能自動啟動;
2)Pump程式自啟動失敗,出現報錯:

點選(此處)摺疊或開啟

  1. ERROR OGG-06601 Oracle GoldenGate Capture for Oracle, pmp1.prm: Mismatch between the length of seqno from checkpoint (9) and recovery (6) for extract trail E:\ggs_1\dirdat\rt.
3)在手動啟動Pump程式後,恢復正常,日誌輸出如下:

點選(此處)摺疊或開啟

  1. 2016-07-11 17:04:47 INFO OGG-00993 Oracle GoldenGate Capture for Oracle, pmp1.prm: EXTRACT PMP1 started.
  2. 2016-07-11 17:05:12 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): info all.
  3. 2016-07-11 17:05:16 INFO OGG-01226 Oracle GoldenGate Capture for Oracle, pmp1.prm: Socket buffer size set to 27985 (flush size
  4. 27985).
  5. 2016-07-11 17:05:16 INFO OGG-01055 Oracle GoldenGate Capture for Oracle, pmp1.prm: Recovery initialization completed for target file E:\ggs_1\dirdat\rt000000006, at RBA 1505.
  6. 2016-07-11 17:05:16 INFO OGG-01055 Oracle GoldenGate Capture for Oracle, pmp1.prm: Recovery initialization completed for target file E:\ggs_1\dirdat\st000000007, at RBA 1505.
  7. 2016-07-11 17:05:16 INFO OGG-01478 Oracle GoldenGate Capture for Oracle, pmp1.prm: Output file E:\ggs_1\dirdat\rt is using format RELEASE 12.2.
  8. 2016-07-11 17:05:17 INFO OGG-01478 Oracle GoldenGate Capture for Oracle, pmp1.prm: Output file E:\ggs_1\dirdat\st is using format RELEASE 12.2.
  9. 2016-07-11 17:05:18 INFO OGG-01026 Oracle GoldenGate Capture for Oracle, pmp1.prm: Rolling over remote file E:\ggs_1\dirdat\rt000000007.
  10. 2016-07-11 17:05:19 INFO OGG-01053 Oracle GoldenGate Capture for Oracle, pmp1.prm: Recovery completed for target file E:\ggs_1\dirdat\rt000000007, at RBA 807.
  11. 2016-07-11 17:05:19 INFO OGG-01026 Oracle GoldenGate Capture for Oracle, pmp1.prm: Rolling over remote file E:\ggs_1\dirdat\st000000008.
  12. 2016-07-11 17:05:19 INFO OGG-01053 Oracle GoldenGate Capture for Oracle, pmp1.prm: Recovery completed for target file E:\ggs_1\dirdat\st000000008, at RBA 807.
  13. 2016-07-11 17:05:19 INFO OGG-01057 Oracle GoldenGate Capture for Oracle, pmp1.prm: Recovery completed for all targets.
  14. 2016-07-11 17:05:21 INFO OGG-02243 Oracle GoldenGate Capture for Oracle, pmp1.prm: Opened trail file /u01/ggs_1/dirdat/lt000000004 at 2016-07-11 17:05:21.173524.
  15. 2016-07-11 17:05:21 INFO OGG-02232 Oracle GoldenGate Capture for Oracle, pmp1.prm: Switching to next trail file /u01/ggs_1/dirdat/lt000000005 at 2016-07-11 17:05:21.639963 due to EOF. with current RBA 1,463.
  16. 2016-07-11 17:05:21 INFO OGG-01026 Oracle GoldenGate Capture for Oracle, pmp1.prm: Rolling over remote file E:\ggs_1\dirdat\rt000000008.
  17. 2016-07-11 17:05:22 INFO OGG-01026 Oracle GoldenGate Capture for Oracle, pmp1.prm: Rolling over remote file E:\ggs_1\dirdat\st000000009.

接上繼續,鑑於以上情況,務必在Manager程式中加上AUTORESTART引數。但最好還是要人工登入檢視狀態。

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

相關文章