今天一个客户的Goldengate的extract进程组异常中断,分析ogg日志发现日志提示ora-00916错误,如下:
OGG-00916 Column FSE cannot be used as a key column. Define a unique index for table ANBOB.TAB_XXX without this column or use the KEYCOLS parameter to correct this issue.
查看表的索引和列类型
SQL> @ind ANBOB.TAB_XXX TABLE_OWNER TABLE_NAME INDEX_NAME POS# COLUMN_NAME DSC -------------------- --------------- ------------------------------ ---- ------------------------------ ---- ANBOB TAB_XXX IDX_CPZGLSZ_CLLX 1 YWLX IDX_CPZGLSZ_ORGCODE 1 ORGCODE 2 OCID PK_CPZGLSZ 1 ID 2 GRZH 3 JZNY PK_CPZGLSZ1 1 ID 2 GRZH 3 JZNY 4 GRZHYE 5 FSE INDEX_OWNER TABLE_NAME INDEX_NAME IDXTYPE UNIQ STATUS PART TEMP H LFBLKS NDK NUM_ROWS CLUF LAST_ANAL DEGREE VISIBILIT -------------------- ------------------------------ ------------------------------ ---------- ---- -------- ---- ---- -- ---------- ------------- --------------- --------------- --------- ------ --------- ANBOB TAB_XXX IDX_CPZGLSZ_CLLX NORMAL NO VALID NO N 4 218316 62 64397234 2684163 29-OCT-25 1 VISIBLE TAB_XXX IDX_CPZGLSZ_ORGCODE NORMAL NO VALID NO N 4 235836 55 61065818 3302371 29-OCT-25 1 VISIBLE TAB_XXX PK_CPZGLSZ NORMAL NO VALID NO N 4 398810 60150309 60150309 10060501 29-OCT-25 1 VISIBLE TAB_XXX PK_CPZGLSZ1 FBI NORMAL YES VALID NO N 4 489446 60076929 60076929 10383477 29-OCT-25 1 VISIBLE SQL>
Note: 表上索UI 唯一索引,但是是一个funcion base index函数索引,查看列类型FSE是否是不支持的索引列类型。本案例是一个varchar类型。
ogg支持的同步要有PK,UI, 同时UI还不支持虚拟列、用户定义数据类型、扩展long varchar,及函数索引。否则会使用所有列,这点在日志中会有提示。
错误代码
OGG-00916: Column {1} cannot be used as a key column. Define a unique index for table {0} without this column or use the KEYCOLS parameter to correct this issue
The specified column in the table key is of a type that is not supported for use as a key by Oracle GoldenGate.
Action:
If the key cannot be altered to remove the column, you can specify a unique index or you can define a key with the KEYCOLS clause of TABLE and MAP. The index or KEYCOLS must match on the source and target tables.
解决方法
extract进程指定keycols 逻辑KEY,如
TABLE ANBOB.TAB_XXX, KEYCOLS(ID,GRZH,JZNY);