GoldenGate抽取Informix資料庫安裝及配置

margiex發表於2018-04-29

 

GoldenGate抽取Informix資料庫安裝及配置


本次測試架構

clip_image002[4]

l  在中間機上安裝informix csdk4.10版本,並編譯配置unixODBC;

l  在中間機上安裝ogg for Informix 12.2,負責抽取informix主機的資料;

l  在目標端oracle節點 上安裝ogg for oracle 12.2,負責接收增量資料並寫入到oracle db.

 

 

安裝配置

源端主機上啟用cdc功能

使用dbaccess,執行 $INFORMIXDIR/etc/syscdcv1.sql

建立相應的配置表。

除此項操作外,後面所有操作都在中間機上完成。

linux下安裝informix csdk

建立一個informix使用者,用於負責執行OGG軟體

groupadd informix

useradd informix -m -g informix

passwd informix

中間機安裝unixODBC

從此處下載原始碼, http://www.unixodbc.org/
如果是64linux
,需要先設定下面的環境變數

export CFLAGS="-DBUILD_REAL_64_BIT_MODE"

編譯 unixOdbc

使用root使用者

./configure

make

make install

informix csdk安裝及配置

修改linux機器的hosts,在linux機器上指向目標informix機器
中間機
/etc/hosts

9.1.11.45  ids_host

檢視informix主機上informix服務埠
{informix:/informix/etc]cat /etc/services

ids_svs     48012/tcp # informix service port

並在linux機器的services看新增同樣一行內容

配置環境變數,並新增到.bashrc

export INFORMIXDIR=/opt/IBM/informix

export LD_LIBRARY_PATH=$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql:$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql::$INFORMIXDIR/lib/cli:$INFORMIXDIR/lib/esql

export INFORMIXSERVER=ids_host

export ONCONFIG=onconfig.ids_host

export ODBCINI=$INFORMIXDIR/odbc.ini

export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/sqlhosts

sqlhosts的內容如下

主機名稱和服務名與前面設定的服務名及主機名保持一致。

ids_host        onsoctcp       9.1.11.45       ids_svs

安裝ids sdk 4.10

root使用者執行
./ids_install
使用預設選項安裝,但不要選擇
create service option.

安裝完成之後,預設所有檔案是在 /opt/IBM/informix 目錄,

配置odbc並測試

建立odbc.ini

該檔案所在目錄需要與前面指定的 ODBCINI 環境變數路徑相同。

[ODBC Data Sources]

testdb_dsn=IBM INFORMIX ODBC DRIVER

oggcdc=IBM INFORMIX ODBC DRIVER

 

[oggcdc]

Driver=/opt/IBM/informix/lib/cli/iclis09b.so

Description=IBM INFORMIX ODBC DRIVER

Database=syscdcv1

LogonID=informix

pwd=informix

Servername=ids_host

cursorBehavior=0

CLIENT_LOCALE=en_us.8859-1

DB_LOCALE=en_us.8859-1

TRANSLATIONDLL=/opt/IBM/informix/lib/esql/igo4a304.so

 

[testdb_dsn]

Driver=/opt/IBM/informix/lib/cli/iclis09b.so

Description=IBM INFORMIX ODBC DRIVER

Database=test_db

LogonID=informix

pwd=informix

Servername=ids_host

cursorBehavior=0

CLIENT_LOCALE=en_us.8859-1

DB_LOCALE=en_us.8859-1

TRANSLATIONDLL=/opt/IBM/informix/lib/esql/igo4a304.so

 

[ODBC]

UNICODE=UTF-8

Trace=0

TraceFile=/tmp/odbctrace.out

InstallDir=/opt/IBM/informix

TRACEDLL=idmrs09a.so

建立odbcinst.ini

odbc.ini相同目錄下建立odbcinst.ini

[ODBC Drivers]

IBM INFORMIX ODBC DRIVER=Installed

[IBM INFORMIX ODBC DRIVER]

Driver=/opt/IBM/informix/lib/cli/iclit09b.so

Setup=/opt/IBM/informix/lib/cli/iclit09b.so

APILevel=1

ConnectFunctions=YYY

DriverODBCVer=03.51

FileUsage=0

SQLLevel=1

smProcessPerConnect=Y

測試連線

isql -v testdb_dsn

SQL> select count(*) from ogguser.test_tb1;

+------------------+

|                  |

+------------------+

| 0                |

+------------------+

SQLRowCount returns -1

1 rows fetched

SQL>

確保ODBC可以正常連線。

 

OGG配置

linux中間機上

確認源表已經開啟附加日誌

GGSCI>dblogin sourcedb testdb_dsn userid informix, password informix

格式:info trandata dbname.owner.tb_name

GGSCI>info trandata testdb.ogguser.test_tb1

抽取程式 exinf.prm

extract exinf

sourcedb oggcdc

extTRAIL ./dirdat/in

table testdb.ogguser.test_tb1;

GGSCI>add ext exinf, vam, begin now
GGSCI>add exttrail ./dirdat/in, ext exinf

傳輸程式 puinf.prm

extract puinf

passthru

rmthost 9.1.9.58 , mgrport 7809  

rmttrail ./dirdat/in

table testdb.ogguser.*;

GGSCI>add ext puinf, exttrailSource ./dirdat/in
GGSCI>add rmttrail ./dirdat/in, ext puinf


測試

源端啟動抽取和傳輸程式

GGSCI>start exinf GGSCI>start puinf

檢視日誌讀取資訊

GGSCI (linuxhost as informix@testdb_dsn/testdb) 20> info exinf showch

 

EXTRACT   EXINF     Last Started 2018-04-26 14:03   Status RUNNING

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

Process ID           9589

VAM Read Checkpoint 2018-04-26 14:03:40.602097

 

 

Current Checkpoint Detail:

Read Checkpoint #1

  VAM External Interface

  Startup Checkpoint (starting position in the data source):

    Timestamp: 2018-04-26 14:03:40.602097

 

  Recovery Checkpoint (position of oldest unprocessed transaction in the data source):

    Timestamp: 2018-04-26 14:03:40.602097

 

  Current Checkpoint (position of last record read in the data source):

    Timestamp: 2018-04-26 14:03:40.602097

 

Write Checkpoint #1

  GGS Log Trail

  Current Checkpoint (current write position):

    Sequence #: 0

    RBA: 1294

    Timestamp: 2018-04-26 14:33:31.475848

    Extract Trail: ./dirdat/in

    Seqno Length: 9

    Flip Seqno Length: No

    Trail Type: EXTTRAIL

 

Header:

  Version = 2

  Record Source = A

  Type = 8

  # Input Checkpoints = 1

  # Output Checkpoints = 1

 

File Information:

  Block Size = 2048

  Max Blocks = 100

  Record Length = 20480

  Current Offset = 0

 

Configuration:

  Data Source = 5

  Transaction Integrity = 1

  Task Type = 0

 

Status:

  Start Time = 2018-04-26 14:03:44

  Last Update Time = 2018-04-26 14:33:31

  Stop Status = A

  Last Result = 400

檢視程式執行資訊

GGSCI (linuxhost as informix@testdb_dsn/testdb) 21> view report exinf

 

***********************************************************************

                Oracle GoldenGate Capture for Informix

      Version 12.2.0.1.1 OGGCORE_12.2.0.1.0_PLATFORMS_151211.1401

 Linux, x64, 64bit (optimized), Informix_SDK410 on Dec 11 2015 17:53:18

 

Copyright (C) 1995, 2015, Oracle and/or its affiliates. All rights reserved.

 

 

                    Starting at 2018-04-26 14:03:44

***********************************************************************

 

Operating System Version:

Linux

Version #1 SMP Sun Nov 10 22:19:54 EST 2013, Release 2.6.32-431.el6.x86_64

Node: cjpocdb3

Machine: x86_64

                         soft limit   hard limit

Address Space Size  :    unlimited    unlimited

Heap Size            :    unlimited    unlimited

File Size            :   unlimited    unlimited

CPU Time             :    unlimited    unlimited

 

Process id: 9589

 

Description:

 

***********************************************************************

**            Running with the following parameters                  **

***********************************************************************

 

2018-04-26 14:03:44 INFO    OGG-03059  Operating system character set identified as UTF-8.

 

2018-04-26 14:03:44 INFO    OGG-02695  ANSI SQL parameter syntax is used for parameter parsing.

extract exinf

sourcedb oggcdc

 

2018-04-26 14:03:44 INFO    OGG-03036  Database character set identified as ISO-8859-1. Locale: en_US.

 

2018-04-26 14:03:44 INFO    OGG-03037  Session character set identified as ISO-8859-1.

extTRAIL ./dirdat/in

table testdb.ogguser.test_tb1;

 

2018-04-26 14:03:44 INFO    OGG-01851  filecaching started: thread ID: 139798135228160.

 

2018-04-26 14:03:44 INFO    OGG-01815  Virtual Memory Facilities for: COM

    anon alloc: mmap(MAP_ANON)  anon free: munmap

    file alloc: mmap(MAP_SHARED)  file free: munmap

    target directories:

    /home/informix/ogg/dirtmp.

 

CACHEMGR virtual memory values (may have been adjusted)

CACHEPAGEOUTSIZE (default):               8M

PROCESS VM AVAIL FROM OS (min):         128G

CACHESIZEMAX (strict force to disk):     96G

 

Database Version:

Informix

Version 11.70.0000 FC7

ODBC Version 03.51

 

Driver Information:

iclis09b.so

Version  3.70.0000 3.70.U

ODBC Version 03.51

 

2018-04-26 14:03:44 INFO    OGG-01052  No recovery is required for target file ./dirdat/in000000000, at RBA 0 (file not opened).

 

2018-04-26 14:03:44 INFO    OGG-01478  Output file ./dirdat/in is using format RELEASE 12.2.

 

2018-04-26 14:03:44 INFO    OGG-00182  VAM API running in single-threaded mode.

 

2018-04-26 14:03:44 INFO    OGG-01515  Positioning to begin time 2018-4-26 下午2:03:40.

 

***********************************************************************

**                     Run Time Messages                             **

***********************************************************************

 

可以看到,可以正常讀取informix db的相關資訊,並開始增量資料的捕獲。

目標端投遞程式的配置與標準的OGG配置相同,不在本文贅述。

 

 

ref

https://docs.oracle.com/goldengate/c1221/gg-winux/GIINF/toc.htm

https://www.ibm.com/developerworks/cn/data/library/techarticle/dm-1108odbcdrivermanager/  

https://blog.csdn.net/cy309173854/article/details/54927248

 

相關文章