gpt4 book ai didi

c++ - Oracle Golden Gate 用户导出 - EXIT_CALL_PROCESS_RECORD 未通过

转载 作者:太空宇宙 更新时间:2023-11-04 12:58:20 26 4
gpt4 key购买 nike

我在 Oracle Golden Gate 中遇到 create custom User Exit 问题。我需要在数据库复制期间连接到更改流并创建此更改的 JSON 字符串。

此刻,我有一个从 Oracle 12c 到 Oracle 12c 的完全正常工作的数据库复制,我创建了一个简单的库,用于将 GoldenGate 提取发送的事件发送到日志。

目前一切正常,我需要捕获 EXIT_CALL_PROCESS_RECORD 因为此类事件包含表名、列和数据 ( Exit Call Types )但由于某种原因,这个事件没有出现,在报告文件中我只有三种类型的事件:

EXIT_CALL_CHECKPOINT
EXIT_CALL_BEGIN_TRANS
EXIT_CALL_END_TRANS

如何调用 EXIT_CALL_PROCESS_RECORD 调用类型?

这是我当前的配置和退出用户源代码:

数据挖掘器:

EXTRACT REXT1
EXTTRAIL ./dirdat/Z1
TRANLOGOPTIONS DBLOGREADER
GETUPDATEBEFORES
FETCHOPTIONS FETCHPKUPDATECOLS
USERID GGUSER@192.168.99.100: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 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;
}

最佳答案

代码本身似乎是正确的。如果您用 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;
}

关于c++ - Oracle Golden Gate 用户导出 - EXIT_CALL_PROCESS_RECORD 未通过,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45485809/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com