Oracle goldengate同步SQL server数据库测试实验中遇到的问题汇总
问题描述
最近一直反复在测试OGG同步SQL server之间的数据库同步实验,每次实验都会出现不一样的问题。
为此编写此篇文章记录。
链接: 【绝对无坑版,亲测流程】oracle goldengate同步SQL server到SQL server的实时数据同步
问题1.
OGG-25168 The specified GGSCHEMA name ‘ggs’ in the GLOBALS file does not exist in the database
如上错误在添加TRANDATA的时候出现,而且尝试反复重建shcme都出现同样的提示。
2025-07-13 07:39:18 ERROR OGG-25168 The specified GGSCHEMA name 'ggs' in the GLOBALS file does not exist in the database or the user does not have permission to use it. Update the GLOBALS file to specify a valid database schema for GGSCHEMA or create the schema in the database and assign the correct permissions to use it.GGSCI (WIN-H8J332K8OJQ as oggadmin@SSDB) 11>
后来尝试在创建SCHEMA的时候先USE SOURCEDB_NAM,再创建,问题解决。
use amdb
go
CREATE SCHEMA ggs;
问题2.
GGSCI (WIN-IPVE8GMRJ8Q) 8> dblogin sourcedb mssql,userid ggsadmin,password ggsadmin
2025-07-10 23:08:54 WARNING OGG-00552 Database operation failed: Couldn’t connect to mssql. ODBC error: SQLSTATE IM002 native database error 0. [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序.
ERROR: Database operation failed: Couldn’t connect to mssql. ODBC error: SQLSTATE IM002 native database error 0. [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序Failed to open data source mssql for user ggsadmin.GGSCI (WIN-IPVE8GMRJ8Q) 9>
创建了ODBC之后再次登录仍然失败
GGSCI (WIN-IPVE8GMRJ8Q) 12> dblogin sourcedb s_mssql,userid ggsadmin,password ggsadmin
2025-07-10 23:15:18 WARNING OGG-00552 Database operation failed: Couldn’t connect to s_mssql. ODBC error: SQLSTATE 28000 native database error 18456. [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]用户 ‘ggsadmin’ 登录失败。.
ERROR: Database operation failed: Couldn’t connect to s_mssql. ODBC error: SQLSTATE 28000 native database error 18456. [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]用户 ‘ggsadmin’ 登录失败。Failed to open data source s_mssql for user ggsadmin.GGSCI (WIN-IPVE8GMRJ8Q) 13>
后来发现是用户名密码不对
GGSCI (WIN-IPVE8GMRJ8Q) 14> dblogin sourcedb s_mssql,userid oggadmin password oggadmin
2025-07-10 23:18:01 INFO OGG-03036 Database character set identified as windows-936. Locale: zh_CN.
2025-07-10 23:18:01 INFO OGG-03037 Session character set identified as GBK.
Successfully logged into database.GGSCI (WIN-IPVE8GMRJ8Q as oggadmin@S_MSSQL) 15>
问题3.
添加 trandata的时候出现如下错误
GGSCI (WIN-IPVE8GMRJ8Q as oggadmin@S_MSSQL) 21> add trandata dbo.ztab
2025-07-10 23:24:40 ERROR OGG-05263 No GGSCHEMA clause was specified in the GLOBALS file. Specify a GGSCHEMA schema name.
GGSCI (WIN-IPVE8GMRJ8Q as oggadmin@S_MSSQL) 22>
创建一个schema,再次修改GLOBALS参数
use sourcedbname
go
CREATE SCHEMA ggs AUTHORIZATION oggadmin;
问题4.
GGSCI (WIN-IPVE8GMRJ8Q as oggadmin@S_MSSQL) 6> shell ./ogg_cdc_cleanup_setup.bat createJob oggadmin oggadmin zdb localhost,1433 oggsourceschema
‘.’ 不是内部或外部命令,也不是可运行的程序或批处理文件。
解决方法是:在Windows环境下执行脚本去掉./,只要实在当前目录下执行的cmd窗口就行,
问题5.
但是执行的时候出现了新的提示。不能直接用lcoalhost,1433.方式指定数据库实例地址,需要使用HOSTNAME\INSTANCE
GGSCI (WIN-IPVE8GMRJ8Q as oggadmin@S_MSSQL) 7> shell ogg_cdc_cleanup_setup.bat createJob oggadmin oggadmin zdb localhost,1433 oggsourceschema
Oracle GoldenGate CDC cleanup job setup script
==============================================“Usage: ogg_cdc_cleanup_setup.bat {createJob|dropJob|deleteExtCheckpoint|showData|showJob|showSchedule} > <servername[instancename]> ”
“ <servername[instancename]> and are used to login to SQL Server database.”Example:
ogg_cdc_cleanup_setup.bat createJob user1 pword1 dbname1 HOSTNAME\INSTANCE oggschema
ogg_cdc_cleanup_setup.bat dropJob user1 pword1 dbname1 HOSTNAME\INSTANCE oggschemaGGSCI (WIN-IPVE8GMRJ8Q as oggadmin@S_MSSQL) 8>
问题5. SQL server agent未启动
GGSCI (WIN-IPVE8GMRJ8Q as oggadmin@S_MSSQL) 9> shell ogg_cdc_cleanup_setup.bat createJob oggadmin oggadmin zdb localhost oggsourceschema
Oracle GoldenGate CDC cleanup job setup script
==============================================Command: createJob
SQLServerAgent 当前未运行,因此无法将此操作通知它。
The Oracle GoldenGate CDC Cleanup job and its relevant tables and procedures have been created.GGSCI (WIN-IPVE8GMRJ8Q as oggadmin@S_MSSQL) 10>
问题6.启动抽取进程失败
2025-07-10 23:57:36 ERROR OGG-05338 The versions of the Oracle GoldenGate CDC objects on database, zdb,
are not consistent with the expected version, 2. The following version(s) were found: 1. Rerun ADD TRANDATA for all tables previously enabled,
including heartbeat, heartbeat seed, and filter tables.2025-07-10 23:57:36 ERROR OGG-01668 PROCESS ABENDING.
参考:
https://docs.oracle.com/en/middleware/goldengate/core/19.1/obcdc/
OGG-05338: The versions of the Oracle GoldenGate CDC objects on database,
{2}, are not consistent with the expected version, {0}. The following version(s)
were found: {1}. Rerun ADD TRANDATA for all tables previously enabled,
including heartbeat, heartbeat seed, and filter tables.
The Oracle GoldenGate CDC object versions on the database are different than the
version expected by this application.
Action:
Rerun ADD TRANDATA for all tables previously enabled, including heartbeat,
heartbeat seed, and any filter table to correct this issue.
2025-07-11 00:36:17 ERROR OGG-05338 The versions of the Oracle GoldenGate CDC objects on database, zdb,
are not consistent with the expected version, 2. The following version(s) were found: 2,Unknown.
Rerun ADD TRANDATA for all tables previously enabled, including heartbeat, heartbeat seed, and filter tables.2025-07-11 00:36:17 ERROR OGG-01668 PROCESS ABENDING.
查看TRANDATA信息
GGSCI (WIN-IPVE8GMRJ8Q as oggadmin@S_MSSQL) 5> ADD TRANDATA dbo.ztab FILEGROUP cdcfg
Logging of supplemental log data is enabled for table dbo.ztab in filegroup cdcfg
GGSCI (WIN-IPVE8GMRJ8Q as oggadmin@S_MSSQL) 6> info trandata dbo.ztab
Logging of supplemental log data ‘version 2’ is enabled for table dbo.ztab, in filegroup cdcfg, as of 2025-07-11 00:30:03.950.
GGSCI (WIN-IPVE8GMRJ8Q as oggadmin@S_MSSQL) 7>
解决方法,更换OGG21.4后启动正常。
问题7.Server]指定的架构名称 “tggs” 不存在
GGSCI (WIN-IPVE8GMRJ8Q as oggadmin@T_MSSQL) 3> ADD CHECKPOINTTABLE tggs.oggcheck2025-07-11 09:20:26 WARNING OGG-30055 Database error 2760 ([Microsoft][ODBC Driver 17 for SQL Server][SQL Server]指定的架构名称 "tggs" 不存在,或者您没有使用该名称的权限。).
Error: Failed creating checkpoint table [tggs].[oggcheck].<NIL>GGSCI (WIN-IPVE8GMRJ8Q as oggadmin@T_MSSQL) 4>
解决方法:
use amdb
go
CREATE SCHEMA tggs;
问题8.时间转换失败
Source Context :SourceModule : [gglib.ggdbsql.driver.odbc]SourceID : [ggdbsql/odbc/ODBCDriver.cpp]SourceMethod : [ggs::gglib::ggdbsql::CODBCResult::ExecuteDirect]SourceLine : [1975]ThreadBacktrace : [13] elements: [D:\ogg21\gglog.dll(??1CContextItem@@UEAA@XZ)]: [D:\ogg21\gglog.dll(?CreateMessage@CMessageFactory@@QEAAPEAVCMessage@@PEAVCSourceContext@@IZZ)]: [D:\ogg21\gglog.dll(?_MSG_String_String_String_Int32@@YAPEAVCMessage@@PEAVCSourceContext@@HPEBD11HW4MessageDisposition@CMessageFactory@@@Z)]: [D:\ogg21\extract.exe(VAMVersion)]: [D:\ogg21\extract.exe(VAMVersion)]: [D:\ogg21\extract.exe(VAMVersion)]: [D:\ogg21\extract.exe(VAMVersion)]: [D:\ogg21\extract.exe(VAMVersion)]: [D:\ogg21\extract.exe(VAMVersion)]: [D:\ogg21\extract.exe(VAMVersion)]: [D:\ogg21\extract.exe(_ggTryDebugHook)]: [C:\Windows\System32\KERNEL32.DLL(BaseThreadInitThunk)]: [C:\Windows\SYSTEM32\ntdll.dll(RtlUserThreadStart)]2025-07-11 10:02:39 ERROR OGG-00551 Database operation failed: Execute direct.
ODBC error: SQLSTATE 22007 native database error 241.
[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]从字符串转换日期和/或时间时,转换失败。.
出现该错误之后,抽取进程停止,但是状态是RUNNING的。
后来在MOS上查找到如下解释:
Bug 33884867: SQL Server - Extract abends with “OGG-00551 Database operation failed: Execute direct. ODBC error: SQLSTATE 22007 native database error 241. [Microsoft][ODBC Driver 17 for SQL Server][”
Fixed an issue with translating data from different languages by setting the session language as us_english for manager connection.
尝试添加NLS_LANG参数启动出现同样的问题
setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
setenv (NLS_LANG = AMERICAN_AMERICA.AL32UTF8)
set NLS_LANG = AMERICAN_AMERICA.AL32UTF8
2025-07-11 16:02:51 ERROR OGG-00551 Database operation failed: Execute direct. ODBC error: SQLSTATE 22007 native database error 241.
[Microsoft][SQL Server Native Client 11.0][SQL Server]从字符串转换日期和/或时间时,转换失败。.
解决方法就是:下载更新OGG版本到最新的补丁号即可。
You are downloading the base release version of GoldenGate. You can either install this base release and then download and install the
latest Release Update, or download and install the full release package which includes the latest Release Update.
Installing the latest Release Update will ensure you have the most current security and functionality.
Refer to " Latest GoldenGate/Database (OGG/RDBMS) Patch recommendations" Doc ID: 2193391.1) for more information.
Primary Note for Oracle GoldenGate Core Product Patch Sets (Doc ID 1645495.1)
问题9.SQL server版本更新问题
在测试过程中同时发现,SQL server的初始版本,就是那种不带更新补丁的版本可能会导致抽取进程启动失败。
错误信息中会提示支持的最低的SQL server补丁号。
比如初始版本,在启动抽取进程的时候会提示需要CU5及以上的补丁更新才支持。根据实际情况安排计划更新数据库补丁更新即可。如下链接可以直接查找到并下载。
需要注意的是,数据库的版本更新设计到应用的兼容性,故还需要配合应用开发的同事一同协商测试验证。
Microsoft SQL Server 2016 (RTM) - 13.0.1601.5 (X64) Apr 29 2016 23:23:58 Copyright © Microsoft Corporation Enterprise Edition (64-bit) on Windows Server 2016 Standard 6.3 (Build 14393: )
链接: SQL Server 的最新更新和版本历史记录