2017-08-03 5 views
1

Oracle Golden Gateにはcreate custom User Exitという問題があります。 データベースレプリケーション中に変更のストリームに接続し、この変更のJSON文字列を作成する必要があります。Oracle Golden Gateユーザー出口 - EXIT_CALL_PROCESS_RECORDが渡されない

Oracle 12cからOracle 12cへの完全なデータベース・レプリケーションがありますが、私はGoldenGateの抽出したログ・イベントを送信する簡単なライブラリを作成しました。

すべてはこの瞬間に動作しますが、私は私が3種類のみを持っているこのタイプのイベントは、レポートファイルに、テーブル名、列とデータ(Exit Call Types) しかし、このイベントが表示されない何らかの理由が含まれているためEXIT_CALL_PROCESS_RECORDをキャッチする必要があります私はEXIT_CALL_PROCESS_RECORDコールタイプを呼び出すことができますどのように

EXIT_CALL_CHECKPOINT 
EXIT_CALL_BEGIN_TRANS 
EXIT_CALL_END_TRANS 

:イベントの?

これは私の現在の設定と出口ユーザーソースコードです:

データ鉱夫:

EXTRACT REXT1 
EXTTRAIL ./dirdat/Z1 
TRANLOGOPTIONS DBLOGREADER 
GETUPDATEBEFORES 
FETCHOPTIONS FETCHPKUPDATECOLS 
USERID [email protected]:32774/xe , PASSWORD GGUSER 
TABLE ERP.*; 

データポンプ:

EXTRACT REXT2 
DISCARDFILE ./dirrpt/eqalap.dsc, PURGE 
RMTHOST 127.0.0.1, MGRPORT 7851, COMPRESS 
RMTTRAIL ./dirdat/Z2 
CUSEREXIT hello.so CUSEREXIT, INCLUDEUPDATEBEFORES 
NOPASSTHRU 
MAP ERP.*, TARGET HRMS.*; 

Replicat:

replicat RREP1 
setenv (NLS_LANG = AMERICAN_AMERICA.WE8MSWIN1252) 
useridalias GGTARGETADMIN domain OGG 
handlecollisions 
assumetargetdefs 
CUSEREXIT hello.so CUSEREXIT, INCLUDEUPDATEBEFORES 
map HRMS.* target HRMS.* ; 

ユーザー出口のソースコード:

#include <stdio.h> 
#include <sys/types.h> 
#include <stdlib.h> 
#include <stdint.h> 
#include <ctype.h> 
#include "usrdecs.h" 
#include <string> 
#include <iostream> 
#include <fstream> 
#include <sstream> 

using namespace std; 

extern "C" { 
    void ERCALLBACK(ercallback_function_codes function_code, void *buf, short *presult_code); 
    void call_callback(ercallback_function_codes function_code, void *buf, short *result_code); 
    void output_msg(char *msg, ...); 
    void CUSEREXIT(exit_call_type_def exit_call_type, exit_result_def *exit_call_result, exit_params_def *exit_params); 
} 

void ERCALLBACK(ercallback_function_codes function_code, void *buf, short *presult_code); 
void call_callback(ercallback_function_codes function_code, void *buf, short *result_code); 
void CUSEREXIT(exit_call_type_def exit_call_type, exit_result_def *exit_call_result, exit_params_def *exit_params); 

void call_callback(ercallback_function_codes function_code, void *buf, short *result_code) { 
    ERCALLBACK(function_code, buf, result_code); 
} 

void output_msg(char *msg, ...) { 
    short result_code; 
    char temp_msg[1000]; 

    va_list args; 

    vsprintf(temp_msg, msg, args); 
    call_callback(OUTPUT_MESSAGE_TO_REPORT, temp_msg, &result_code); 
} 

void CUSEREXIT(exit_call_type_def exit_call_type, exit_result_def *exit_call_result, exit_params_def *exit_params) { 
    short result_code; 

    switch (exit_call_type) { 
    case EXIT_CALL_START: 
     output_msg((char*)"EXIT_CALL_START\n", result_code); 
     break; 
    case EXIT_CALL_BEGIN_TRANS: 
     output_msg((char*)"EXIT_CALL_BEGIN_TRANS\n", result_code); 
     break; 
    case EXIT_CALL_PROCESS_RECORD: 
     output_msg((char*)"EXIT_CALL_PROCESS_RECORD\n", result_code); 
     break; 
    case EXIT_CALL_DISCARD_ASCII_RECORD: 
     output_msg((char*)"EXIT_CALL_DISCARD_ASCII_RECORD\n", result_code); 
     break; 
    case EXIT_CALL_DISCARD_RECORD: 
     output_msg((char*)"EXIT_CALL_DISCARD_RECORD\n", result_code); 
     break; 
    case EXIT_CALL_END_TRANS: 
     output_msg((char*)"EXIT_CALL_END_TRANS\n", result_code); 
     break; 
    case EXIT_CALL_CHECKPOINT: 
     output_msg((char*)"EXIT_CALL_CHECKPOINT\n", result_code); 
     break; 
    case EXIT_CALL_PROCESS_MARKER: 
     output_msg((char*)"EXIT_CALL_PROCESS_MARKER\n", result_code); 
     break; 
    case EXIT_CALL_STOP: 
     output_msg((char*)"EXIT_CALL_STOP\n", result_code); 
     break; 
    case EXIT_CALL_DISCARD_TRANS_RECORD: 
     output_msg((char*)"EXIT_CALL_DISCARD_TRANS_RECORD\n", result_code); 
     break; 
    case EXIT_CALL_ABORT_TRANS: 
     output_msg((char*)"EXIT_CALL_ABORT_TRANS\n", result_code); 
     break; 
    case EXIT_CALL_EVENT_RECORD: 
     output_msg((char*)"EXIT_CALL_EVENT_RECORD\n", result_code); 
     break; 
    case EXIT_CALL_FATAL_ERROR: 
     output_msg((char*)"EXIT_CALL_FATAL_ERROR\n", result_code); 
     break; 
    default: 
     output_msg((char*)"default\n", result_code); 
     break; 
    } 

    *exit_call_result = EXIT_OK_VAL; 
} 

答えて

0

コード自体が正しいと思われます。同じコードをC++ではなくC言語でコンパイルすると、正しく動作します。 OracleにSR要求を提出する必要があります。これはバグかもしれません。

#include <stdio.h> 

    #if defined(__linux__) 
    #include <stdint.h> 
    #include <stdarg.h> 
    #define I64_FMT "%Ld" 
    #endif 

    #if defined(__MVS__) 
    #include <stdarg.h> 
    #include <varargs.h> 
    #include <inttypes.h> 
    #define I64_FMT "%lld" 
    #endif 

    #if !defined(__MVS__) && !defined(__linux__) 
    #include <stdarg.h> 
    #define I64_FMT "%lld" 
    #endif 

    #include <string.h> 
    #include <sys/types.h> 
    #include <stdlib.h> 
    #include <ctype.h> 

#include "usrdecs.h" 

void call_callback(ercallback_function_codes function_code, void *buf, short *result_code) { 
    ERCALLBACK(function_code, buf, result_code); 
} 

void output_msg(char *msg, ...) { 
    short result_code; 
    char temp_msg[1000]; 

    va_list args; 

    vsprintf(temp_msg, msg, args); 
    call_callback(OUTPUT_MESSAGE_TO_REPORT, temp_msg, &result_code); 
} 

void CUSEREXIT(exit_call_type_def exit_call_type, exit_result_def *exit_call_result, exit_params_def *exit_params) { 
    short result_code; 

    switch (exit_call_type) { 
    case EXIT_CALL_START: 
     output_msg((char*)"EXIT_CALL_START\n", result_code); 
     break; 
    case EXIT_CALL_BEGIN_TRANS: 
     output_msg((char*)"EXIT_CALL_BEGIN_TRANS\n", result_code); 
     break; 
    case EXIT_CALL_PROCESS_RECORD: 
     output_msg((char*)"EXIT_CALL_PROCESS_RECORD\n", result_code); 
     break; 
    case EXIT_CALL_DISCARD_ASCII_RECORD: 
     output_msg((char*)"EXIT_CALL_DISCARD_ASCII_RECORD\n", result_code); 
     break; 
    case EXIT_CALL_DISCARD_RECORD: 
     output_msg((char*)"EXIT_CALL_DISCARD_RECORD\n", result_code); 
     break; 
    case EXIT_CALL_END_TRANS: 
     output_msg((char*)"EXIT_CALL_END_TRANS\n", result_code); 
     break; 
    case EXIT_CALL_CHECKPOINT: 
     output_msg((char*)"EXIT_CALL_CHECKPOINT\n", result_code); 
     break; 
    case EXIT_CALL_PROCESS_MARKER: 
     output_msg((char*)"EXIT_CALL_PROCESS_MARKER\n", result_code); 
     break; 
    case EXIT_CALL_STOP: 
     output_msg((char*)"EXIT_CALL_STOP\n", result_code); 
     break; 
    case EXIT_CALL_DISCARD_TRANS_RECORD: 
     output_msg((char*)"EXIT_CALL_DISCARD_TRANS_RECORD\n", result_code); 
     break; 
    case EXIT_CALL_ABORT_TRANS: 
     output_msg((char*)"EXIT_CALL_ABORT_TRANS\n", result_code); 
     break; 
    case EXIT_CALL_EVENT_RECORD: 
     output_msg((char*)"EXIT_CALL_EVENT_RECORD\n", result_code); 
     break; 
    case EXIT_CALL_FATAL_ERROR: 
     output_msg((char*)"EXIT_CALL_FATAL_ERROR\n", result_code); 
     break; 
    default: 
     output_msg((char*)"default\n", result_code); 
     break; 
    } 

    *exit_call_result = EXIT_OK_VAL; 
} 
+0

Cでコンパイルした後、すべてがうまくいきます。どうもありがとうございました。 –

関連する問題