GoldenGate抽取Informix数据库安装及配置
GoldenGate抽取Informix数据库安装及配置
本次测试架构
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/
如果是64位linux,需要先设置下面的环境变量
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