模擬oracle rac節點異常時如何保持ogg正常執行

夢夕林1992發表於2023-01-19

環境簡介


系統

Oracle 版本

OGG 版本


源端

Linux 6.9

oracle11204

112101


目標端

Linux 6.9

oracle11204

122022


 

 

準備測試ogg 環境

源端ogg

GGSCI (rac11gn1) 2> info *

 

 

EXTRACT    EXT28     Last Started 2020-11-06 11:20   Status RUNNING

Checkpoint Lag       00:00:00 (updated 00:00:09 ago)

Log Read Checkpoint  Oracle Redo Logs

                     2020-11-06 11:38:43  Thread 1, Seqno 10, RBA 180652544

                     SCN 2979.2159160499 (12796866735283)

Log Read Checkpoint  Oracle Redo Logs

                     2020-11-06 11:38:43  Thread 2, Seqno 17, RBA 573440

                     SCN 2979.2159160499 (12796866735283)

 

----- 挖掘程式的具體引數-----

 

 

GGSCI (rac11gn1) 3> view param ext28

 

extract ext28

setenv (NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK")

--setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)

userid odc,password odc

exttrail ./dirdat/z3

tranlogoptions dblogreader

FETCHOPTIONS FETCHPKUPDATECOLS

ddl include objname test.* exclude objtype 'TRIGGER'

ddloptions addtrandata

table test.test1;

 

 

目標端ogg

GGSCI (oradb) 4> info rep28

 

REPLICAT   REP28     Last Started 2020-11-05 13:38   Status RUNNING

Checkpoint Lag       00:00:00 (updated 00:00:07 ago)

Process ID           5044

Log Read Checkpoint  File ./dirdat/z3000010

                     2020-11-06 13:48:24.927157  RBA 1567

 

----- 應用程式的具體引數-----

GGSCI (oradb) 5> view param rep28

 

replicat rep28

setenv (NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK")

userid odc, password odc

ASSUMETARGETDEFS                        

ALLOWNOOPUPDATES               

DBOPTIONS DEFERREFCONST

HANDLETPKUPDATE

ddl include mapped

DISCARDFILE /ogg/dirrpt/z3.dsc, APPEND megabytes 20

DISCARDROLLOVER on sunday

map test.* target test.*;

 

測試RAC 中一個節點掛機

將二節點關機

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

 

 

觀察ogg 變化

觀察挖掘程式資訊,可以看到二節點的RBA 變為了0.

GGSCI (rac11gn1) 10> info *

 

EXTRACT    DMP28     Last Started 2020-11-06 13:27   Status RUNNING

Checkpoint Lag       00:00:00 (updated 00:00:19 ago)

Log Read Checkpoint  File ./dirdat/z3000013

                     2020-11-06 11:20:33.296830  RBA 1075

 

EXTRACT    EXT28     Last Started 2020-11-06 13:27   Status RUNNING

Checkpoint Lag       00:00:02 (updated 00:00:03 ago)

Log Read Checkpoint  Oracle Redo Logs

                     2020-11-06 13:27:37  Thread 1, Seqno 10, RBA 187623440

                     SCN 2979.2159173792 (12796866748576)

Log Read Checkpoint  Oracle Redo Logs

                     2020-11-06 13:26:37  Thread 2, Seqno 18, RBA 0

                     SCN 2979.2159173716 (12796866748500)

 

 

觀察日誌資訊,出現大量關於二節點資訊

 

2020-11-06 13:30:01  INFO    OGG-01513  Oracle GoldenGate Capture for Oracle, ext28.prm:  Positioning to (Thread 2) Sequence 18, RBA 0, SCN 2979.2159173716.

2020-11-06 13:30:02  INFO    OGG-01513  Oracle GoldenGate Capture for Oracle, ext28.prm:  Positioning to (Thread 2) Sequence 18, RBA 0, SCN 2979.2159173716.

2020-11-06 13:30:04  INFO    OGG-01513  Oracle GoldenGate Capture for Oracle, ext28.prm:  Positioning to (Thread 2) Sequence 18, RBA 0, SCN 2979.2159173716.

2020-11-06 13:30:05  INFO    OGG-01513  Oracle GoldenGate Capture for Oracle, ext28.prm:  Positioning to (Thread 2) Sequence 18, RBA 0, SCN 2979.2159173716.

2020-11-06 13:30:06  INFO    OGG-01513  Oracle GoldenGate Capture for Oracle, ext28.prm:  Positioning to (Thread 2) Sequence 18, RBA 0, SCN 2979.2159173716.

2020-11-06 13:30:07  INFO    OGG-01513  Oracle GoldenGate Capture for Oracle, ext28.prm:  Positioning to (Thread 2) Sequence 18, RBA 0, SCN 2979.2159173716.

2020-11-06 13:30:08  INFO    OGG-01513  Oracle GoldenGate Capture for Oracle, ext28.prm:  Positioning to (Thread 2) Sequence 18, RBA 0, SCN 2979.2159173716.

2020-11-06 13:30:09  INFO    OGG-01513  Oracle GoldenGate Capture for Oracle, ext28.prm:  Positioning to (Thread 2) Sequence 18, RBA 0, SCN 2979.2159173716.

2020-11-06 13:30:10  INFO    OGG-01513  Oracle GoldenGate Capture for Oracle, ext28.prm:  Positioning to (Thread 2) Sequence 18, RBA 0, SCN 2979.2159173716.

 

 

 

刪除二節點

此時挖掘程式無法正常抽取資料,有兩種方法恢復ogg正常執行,一種是重建程式,另外一種則是先排除第二個節點,後續還可以加回去。

我們採用第二種方案。

1. 確認資料庫節點順序

SQL> select distinct thread# from v$log;

   THREAD#

----------

     1

     2

 

--- 注意日誌節點順序與ogg 節點順序是否一致

 

2.禁用 二節點redo

SQL> alter database disable thread 2;

 

3. 加入引數排除二節點

如果上述日誌節點不是順序排序,排除時根據相應的節點排除

GGSCI (rac11gn1) 11> view param ext28

extract ext28

setenv (NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK")

userid odc,password odc

exttrail ./dirdat/z3

tranlogoptions dblogreader

FETCHOPTIONS FETCHPKUPDATECOLS

THREADOPTIONS PROCESSTHREADS EXCEPT 2

或者 THREADOPTIONS PROCESSTHREADS SELECT 1

ddl include objname xjm.* exclude objtype 'TRIGGER'

ddloptions addtrandata

table test.test1;

 

4. 觀察日誌

2020-11-06 14:51:42  ERROR   OGG-01937  Oracle GoldenGate Capture for Oracle, ext28.prm:  Extract is not configured to capture changes from thread 2,158,926,566. To avoid data loss, the Extract must be dropped and recreated with the THREADS option to specify the correct number of RAC instances. See the Oracle GoldenGate administration documentation for the procedure to follow.

 

5. 加入引數修復錯誤

根據mos 參考檔案:

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=486823160967100&id=1507081.1&_adf.ctrl-state=174svw9y8a_851

bug 是在 ogg11.2.0.5 以下版本中會出現,在 11.2.0.5 中已被修復好

GGSCI (rac11gn1) 28> view param ext28

 

extract ext28

setenv (NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK")

--setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)

userid odc,password odc

exttrail ./dirdat/z3

tranlogoptions dblogreader

FETCHOPTIONS FETCHPKUPDATECOLS

THREADOPTIONS PROCESSTHREADS EXCEPT 2

TRANLOGOPTIONS _IGNORETHREADEVENT

ddl include objname test.* exclude objtype 'TRIGGER'

ddloptions addtrandata

table test.test1;

  

觀察後臺日誌,沒有明顯錯誤出現。


新增二節點

1.

--- 將挖掘的引數檔案中將二節點新增回去

GGSCI (rac11gn1) 11> view param ext28

extract ext28

setenv (NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK")

userid odc,password odc

exttrail ./dirdat/z3

tranlogoptions dblogreader

FETCHOPTIONS FETCHPKUPDATECOLS

--THREADOPTIONS PROCESSTHREADS EXCEPT 2

TRANLOGOPTIONS _IGNORETHREADEVENT

ddl include objname test.* exclude objtype 'TRIGGER'

ddloptions addtrandata

table test.test1;

 

--啟用 二節點redo

SQL> alter database enable thread 2;

 

2. 將二節點拉起來

SQL>startup

 

觀察程式是否都正常執行。


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

相關文章