ORACLE GOLDEN GATE COLSEXCEPT无效

时间:2017-02-06 19:03:54

标签: oracle-golden-gate

我正在尝试将表格从生产复制到数据仓库中。当只对这些列执行更新时,有些列我不想要事务。我的印象是COLSEXCEPT命令是我需要使用的

(
https://docs.oracle.com/goldengate/1212/gg-winux/GWURF/gg_parameters160.htm#GWURF546

{COLS | COLSEXCEPT} (column_list) Selects or excludes columns for processing.
TABLE
)  

在我的表中,需要排除BL_ARREARS_IND列,因为它不在我的目标表中。当我仅更新源中的BL_ARREARS_IND列时,它仍然记录事务,然后将其发送到目标服务器。

我有一个提取物和一个泵设置。

EXTRACT extbill

SETENV (ORACLE_SID=******)
SETENV (ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1)
USERID *****, PASSWORD *****
EXTTRAIL /u01/dwdev/oggdev/product/12.1.2/oggcore_2/dirdat/lb
TRANLOGOPTIONS ASMUSER SYS@ASM8, ASMPASSWORD ******

TABLE tmp.bill, &
KEYCOLS(ACCT_ID, BILL_SEQ_NO), &
**COLSEXCEPT(BL_ARREARS_IND);**

DISCARDFILE ./dwdev_ggdev_bill.dsc, APPEND
DiscardRollover at 02:00 ON SUNDAY
EXTRACT pumpbill

RMTHOST tst.corp.intranet, MGRPORT 7812
RMTTRAIL /u01/dwtst/oggdev/product/12.1.2/oggcore_2/dirdat/rb
TABLE tmp.bill **COLSEXCEPT(BL_ARREARS_IND);**

我错过了什么?

2 个答案:

答案 0 :(得分:0)

我误解了COLSEXCEPT命令。我认为只有在对不在COLSEXCEPT列表中的字段进行更改时才会创建事务。它仍然会创建一个事务,但是不会将这些字段发送到目标数据库(仍然不确定为什么要创建事务来更改要排除的字段)。

我确信有更好的方法,但我能够通过在提取中对表中应用过滤器来使用我称之为解决方法的方法来使其工作。这是一个繁琐的过程,因为该表有82个字段。不得不将BEFORE图像与我需要的所有其他81个字段的AFTER图像进行比较。

如果在FILTER中有这么多参数,你必须增加FUNCTIONSTACKSIZE以容纳(在我的情况下需要DBA进行更改)。

我知道必须有更好的方法来解决这个问题,但这里的代码对我有用:

表tmp.bill,KEYCOLS(ACCT_ID,BILL_SEQ_NO),COLSEXCEPT(BL_ARREARS_IND), FILTER(ON UPDATE,((@ BEFORE(ACCT_ID)<> @AFTER(ACCT_ID))或(@ BEFORE(BILL_SEQ_NO)<> @AFTER(BILL_SEQ_NO))或(@ BEFORE(ACTUAL_BALANCE_AMT)<> @AFTER(ACTUAL_BALANCE_AMT))或(@STREQ(@ BEFORE(AFTER_CYCLE_CHG_IND),@ AFTER(AFTER_CYCLE_CHG_IND))= 0)或(@ BEFORE(AGGREGATION_ID)<> @AFTER(AGGREGATION_ID))或(@STREQ(@BEFORE) (APPLICATION_ID),@ AFTER(APPLICATION_ID))= 0)或(@STREQ(@ BEFORE(BANK_ACCOUNT_NO),@ AFTER(BANK_ACCOUNT_NO))= 0)或(@STREQ(@ BEFORE(BANK_CODE),@ AFTER(BANK_CODE)) = 0)或(@STREQ(@ BEFORE(BAN_STATUS),@ AFTER(BAN_STATUS))= 0)或(@STREQ(@ BEFORE(BAN_STATUS_DATE),@ AFTER(BAN_STATUS_DATE))= 0)或(@BEFORE(BF_ADJ) <> @AFTER(BF_ADJ))或(@STREQ(@ BEFORE(BF_BTN),@ AFTER(BF_BTN))= 0)或(@ BEFORE(BF_CALL_CHG)<> @AFTER(BF_CALL_CHG))或(@ BEFORE(BF_IMM_ADJ)LT;> @AFTER(BF_IMM_ADJ))或(@BEFORE(BF_MON_SRV_CHG)LT;> @AFTER(BF_MON_SRV_CHG))或(@BEFORE(BF_ONE_TIME_CRG)LT;> @AFTER(BF_ONE_TIME_CRG))或( @BEFORE(BF_TAXS)<> @AFTER(BF_TAXS))o r(@STREQ(@ BEFORE(BILLING_METHOD),@ AFTER(BILLING_METHOD))= 0)或(@STREQ(@ BEFORE(BILL_CONF_STATUS),@ AFTER(BILL_CONF_STATUS))= 0)或(@STREQ(@ BEFORE(BILL_DATE)) ,@ AFTER(BILL_DATE))= 0)或(@STREQ(@ BEFORE(BILL_DUE_DATE),@ AFTER(BILL_DUE_DATE))= 0)或(@STREQ(@ BEFORE(BILL_STATUS_DATE),@ AFTER(BILL_STATUS_DATE))= 0)或(@STREQ(@ BEFORE(BL_BAL_HANDLE_IND),@ AFTER(BL_BAL_HANDLE_IND))= 0)或(@STREQ(@ BEFORE(CARRY_OVER_IND),@ AFTER(CARRY_OVER_IND))= 0)或(@ BEFORE(CH_BAL_CHGS)<> ; @AFTER(CH_BAL_CHGS))或(@STREQ(@ BEFORE(CREDIT_CARD_NO),@ AFTER(CREDIT_CARD_NO))= 0)或(@STREQ(@ BEFORE(CREDIT_CARD_TYPE),@ AFTER(CREDIT_CARD_TYPE))= 0)或(@STREQ (@ BEFORE(CR_CARD_AUTH_CODE),@ AFTER(CR_CARD_AUTH_CODE))= 0)或(@STREQ(@ BEFORE(CR_CARD_EXP_DATE),@ AFTER(CR_CARD_EXP_DATE))= 0)或(@BEFORE(CURR_CHARGE_AMT)<> @AFTER( CURR_CHARGE_AMT))或(@ BEFORE(CURR_CREDIT_AMT)<> @AFTER(CURR_CREDIT_AMT))或(@ BEFORE(CURR_OC_CHRG_AMT)<> @AFTER(CURR_OC_CHRG_AMT))或(@BEFORE(CURR_RC_CHRG_AMT)<> @AFTER (CURR_RC_CHRG_AMT))或(@ BEFORE(CURR_UC_CHRG_AMT)<> @AFTER(CURR_UC_CHRG_AMT))或(@STREQ(@ BEFORE(CYCLE_CLOSE_DATE),@ AFTER(CYCLE_CLOSE_DATE))= 0)或(@BEFORE(CYCLE_CODE)< > @AFTER(CYCLE_CODE))或(@BEFORE(CYCLE_RUN_MONTH)LT;> @AFTER(CYCLE_RUN_MONTH))或(@BEFORE(CYCLE_RUN_YEAR)LT;> @AFTER(CYCLE_RUN_YEAR))或(@BEFORE(DEPOSIT_PAID_AMT)LT ;> @AFTER(DEPOSIT_PAID_AMT))或(@ BEFORE(DEPOSIT_REQ_AMT)<> @AFTER(DEPOSIT_REQ_AMT))或(@STREQ(@BEF) ORE(DL_SERVICE_CODE),@ AFTER(DL_SERVICE_CODE))= 0)或(@ BEFORE(DL_UPDATE_STAMP)<> @AFTER(DL_UPDATE_STAMP))或(@ BEFORE(FGN_COUNTY_TAX_AMT)<> @AFTER(FGN_COUNTY_TAX_AMT))或(@ BEFORE(FGN_FED_TAX_AMT)<> @AFTER(FGN_FED_TAX_AMT))或(@ BEFORE(FGN_LOCAL_TAX_AMT)<> ; @AFTER(FGN_LOCAL_TAX_AMT))或(@ BEFORE(FGN_STATE_TAX_AMT)<> @AFTER(FGN_STATE_TAX_AMT))或(@ BEFORE(FREE_MINUTE_STATUS)<> @AFTER(FREE_MINUTE_STATUS))或(@ BEFORE(LATE_PYM_BASE_AMT)< > @AFTER(LATE_PYM_BASE_AMT))或(@ BEFORE(MASTER_BAN)<> @AFTER(MASTER_BAN))或(@ BEFORE(MB_BILL_SEQ_NO)<> @AFTER(MB_BILL_SEQ_NO))或(@ BEFORE(NM_ADR_LINK_SEQ_NO)< ;> @AFTER(NM_ADR_LINK_SEQ_NO))或(@BEFORE(NON_TELECOM_AMT)LT;> @AFTER(NON_TELECOM_AMT))或(@BEFORE(NUM_OF_PRODUCTS)LT;> @AFTER(NUM_OF_PRODUCTS))或(@BEFORE(OPERATOR_ID) <> @AFTER(OPERATOR_ID))或(@ BEFORE(PAST_DUE_AMT)<> @AFTER(PAST_DUE_AMT))或(@STREQ(@ BEFORE(PAYMENT_METHOD),@ AFTER(PAYMENT_METHOD))= 0)或(@ BEFORE(PAY_ARR_AMT_DUE)<> @AFTER(PAY_ARR_AMT_DUE))或(@BEFORE(PAY_ARR_AMT_R) EM)<> @AFTER(PAY_ARR_AMT_REM))或(@STREQ(@BEFORE(PRD_CVRG_END_DATE),@ AFTER(PRD_CVRG_END_DATE))= 0)或(@STREQ(@BEFORE(PRD_CVRG_STRT_DATE),@ AFTER(PRD_CVRG_STRT_DATE))= 0)或(@BEFORE (PREV_BALANCE_AMT)<> @AFTER(PREV_BALANCE_AMT))或(@STREQ(@ BEFORE(PRODUCTION_DATE),@ AFTER(PRODUCTION_DATE))= 0)或(@STREQ(@ BEFORE(PRODUCTION_REQUEST),@ AFTER(PRODUCTION_REQUEST)) = 0)或(@STREQ(@ BEFORE(PRODUCTION_TYPE),@ AFTER(PRODUCTION_TYPE))= 0)或(@BEFORE(PRODUCTS_NUM_CALLS)<> @AFTER(PRODUCTS_NUM_CALLS))或(@BEFORE(PRODUCTS_NUM_MINS)<> ; @AFTER(PRODUCTS_NUM_MINS))或(@ BEFORE(PYM_RECEIVED_AMT)<> @AFTER(PYM_RECEIVED_AMT))或(@STREQ(@ BEFORE(SYS_CREATION_DATE),@ AFTER(SYS_CREATION_DATE))= 0)或(@STREQ(@ BEFORE(SYS_UPDATE_DATE),@ AFTER(SYS_UPDATE_DATE))= 0)或(@BEFORE(TAX_FED_AMT)LT;> @AFTER(TAX_FED_AMT))或(@BEFORE(TAX_FED_USF_AMT)LT;> @AFTER(TAX_FED_USF_AMT))或( @ BEFORE(TAX_LOC_AMT)<> @AFTER(TAX_LOC_AMT))或(@ BEFORE(TAX_ROAM_AIR)<> @AFTER(TAX_ROAM_AIR) ))或(@ BEFORE(TAX_ROAM_SRV_CHARGE)<> @AFTER(TAX_ROAM_SRV_CHARGE))或(@ BEFORE(TAX_ROAM_TOLL)<> @AFTER(TAX_ROAM_TOLL))或(@ BEFORE(TAX_STT_AMT)<> @AFTER(TAX_STT_AMT))或(@ BEFORE(TELECOM_AMT)<> ; @AFTER(TELECOM_AMT))或(@ BEFORE(TOTAL_BILLED_ADJUST)<> @AFTER(TOTAL_BILLED_ADJUST))或(@ BEFORE(TOTAL_BILLED_CHARGE)<> @AFTER(TOTAL_BILLED_CHARGE))或(@BEFORE(TOTAL_COUNTY_TAX)< > @AFTER(TOTAL_COUNTY_TAX))或(@ BEFORE(TOTAL_DUE_AMT)<> @AFTER(TOTAL_DUE_AMT))或(@ BEFORE(TOTAL_TAX_FEES)<> @AFTER(TOTAL_TAX_FEES))));

答案 1 :(得分:0)

该代码无法比较空值。我想出了这个宏,它给了我正确的输出。

Filename: check_col.mac

Contents:

MACRO #check_col
PARAMS (#ICOL)
BEGIN
(
(0 = @IF (@COLTEST (@BEFORE(#ICOL), NULL, MISSING),0,1) AND 1 = @IF (@COLTEST (#ICOL, NULL, MISSING), 0, 1))
OR
(1 = @IF (@COLTEST(@BEFORE(#ICOL), NULL, MISSING), 0, 1) AND 0 = @IF (@COLTEST (#ICOL, NULL, MISSING), 0, 1))
OR
(0 = @STREQ(@BEFORE(#ICOL),#ICOL))
)
END;

您可以在INC文件中将此宏用于如下所示的映射:

INCLUDE dirprm/check_col.mac

TABLE S1.T1, KEYCOLS(COL1, COL2), COLSEXCEPT(COL123), FILTER(ON UPDATE,(#check_col(COL3) or #check_col(COL4));

如果以此方式映射超过5列,则代码将引发STACK SIZE NOT ENOUGH错误,FUNCTIONSTACKSIZE = 5000可以解决该错误。让我知道此参数有什么负面影响。