- 场景
OGG中同步Oracle表到Kafka,有些Oracle表有主键,有些没主键,对于没主键的表怎么给表自定义加主键
- 解决
- Extract 进程
extract etest10
GETUPDATEBEFORES
NOCOMPRESSDELETES
NOCOMPRESSUPDATES
TranlogOptions DBLOGREADER
userid ogg_admin, password ogg_admin
exttrail /ogg/dirdat/th
table DBUS.TESTP5;
table DBUS.TESTP6,tokens(zeta_row_id= @GETENV('RECORD',' ROWID'));
table DBUS.TESTP7;
- Pump进程
extract ptest10
passthru
userid ogg_admin, password ogg_admin
rmthost 10.10.10.206, mgrport 7890
rmttrail /ogg/dirdat/th
table DBUS.TESTP5;
table DBUS.TESTP6,tokens(zeta_row_id= @GETENV('RECORD', 'ROWID'));
table DBUS.TESTP7;
- kafka.props
###添加下面一行
gg.handler.kafkahandler.includeTokens=true
- 结果
- 有主键
test10#DBUS.TESTP5 {"table":"DBUS.TESTP5","op_type":"I","op_ts":"2019-09-27 14:52:25.452507","current_ts":"2019-09-27T14:52:31.093000","pos":"00000000080000006329","primary_keys":["ID"],"tokens":{},"after":{"ID":80478,"NAME":"name-80479","AGE":80479,"BIRTHDAY":"2019-08-02 10:00:00","HIGH":180,"SALARY":99,"MIAOSHU":null,"CL":"80479","CC":"我是谁,我在哪里,我在做什么,我是谁,我在哪里,我在做什么我是谁,我在哪里,我在做什么 ","CTSDMP":"2019-08-02 10:00:00.000000000","ADDC1":null,"ADDC2":null,"ADDC3":null}}
- 无主键
test10#DBUS.TESTP6 {"table":"DBUS.TESTP6","op_type":"I","op_ts":"2019-09-27 14:49:10.462259","current_ts":"2019-09-27T14:49:17.220000","pos":"00000000080000002095","primary_keys":["ID","NAME","DD","FF"],"tokens":{"zeta_row_id":"AAAb3AABEAAAA7uAAC"},"after":{"ID":444,"NAME":"eee","DD":"fgdf","FF":null}}
参考:GETENV 的学习