当前位置: 首页 > web >正文

oracle goldengate实现postgresql 到 postgresql的实时同步

oracle goldengate实现postgresql 到 postgresql的实时同步

源端:postgresql1 -> postgresql2 流复制主备同步
目标端:postgresql
数据库版本:postgresql 12.14
ogg版本:21.3

数据库安装以及流复制主备同步配置忽略。以下直接进入OGG的配置

odbc配置:


[root@oradb1 ogg213]# yum list |grep postgresql-odbc.x86_64
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
postgresql-odbc.x86_64                  09.03.0100-2.el7               @centos7 
[root@oradb1 ogg213]# 
[root@oradb1 ogg213]# cat /etc/odbcinst.ini 
# Example driver definitions# Driver from the postgresql-odbc package
# Setup from the unixODBC package
[PostgreSQL]
Description	= ODBC for PostgreSQL
Driver		= /usr/lib64/psqlodbcw.so
Setup		= /usr/lib64/libodbcpsqlS.so
Driver64	= /usr/lib64/psqlodbcw.so
Setup64		= /usr/lib64/libodbcpsqlS.so
FileUsage	= 1# Driver from the mysql-connector-odbc package
# Setup from the unixODBC package
[MySQL]
Description	= ODBC for MySQL
Driver		= /usr/lib/libmyodbc5.so
Setup		= /usr/lib/libodbcmyS.so
Driver64	= /usr/lib64/libmyodbc5.so
Setup64		= /usr/lib64/libodbcmyS.so
FileUsage	= 1
[root@oradb1 ogg213]# cat /etc/odbc.ini 
#Sample DSN entries
[ODBC Data Sources]
PG_src=DataDirect 12.14 PostgreSQL Wire Protocol
PG_tgt=DataDirect 12.14 PostgreSQL Wire Protocol[ODBC]
IANAAppCodePage=4
InstallDir=/ogg213[pg_src1]
Driver=/ogg213/lib/GGpsql25.so
Description=DataDirect 12.14 PostgreSQL Wire Protocol
Database=testdb
HostName=192.168.56.11
PortNumber=5432
LogonID=ggadmin
Password=Bai_yun123
TransactionErrorBehavior=2[pg_src]
Driver=/ogg213/lib/GGpsql25.so
Description=DataDirect 12.14 PostgreSQL Wire Protocol
Database=testdb
HostName=192.168.56.12
PortNumber=5432
LogonID=ggadmin
Password=Bai_yun123
TransactionErrorBehavior=2[pg_tgt]
Driver=/ogg213/lib/GGpsql25.so
Description=DataDirect 12.14 PostgreSQL Wire Protocol
Database=testdb
HostName=192.168.56.101
PortNumber=5432
LogonID=ggadmin
Password=Bai_yun123
TransactionErrorBehavior=2
[root@oradb1 ogg213]# 

验证登录成功:


GGSCI (oradb1) 6> dblogin sourcedb pg_src userid ggadmin password Bai_yun1232025-05-30 21:45:31  INFO    OGG-03036  Database character set identified as UTF-8. Locale: en_US.UTF-8.2025-05-30 21:45:31  INFO    OGG-03037  Session character set identified as UTF-8.
Successfully logged into database.GGSCI (oradb1 as ggadmin@pg_src) 7> dblogin sourcedb pg_tgt userid ggadmin password Bai_yun1232025-05-30 21:45:38  INFO    OGG-03036  Database character set identified as UTF-8. Locale: en_US.UTF-8.2025-05-30 21:45:38  INFO    OGG-03037  Session character set identified as UTF-8.
Successfully logged into database.GGSCI (oradb1 as ggadmin@pg_tgt) 8> 

OGG解压:

[root@oradb1 soft]# cd oggsoft/
[root@oradb1 oggsoft]# ll
total 467684
-rwxrwxr-x 1 postgres postgres  97040905 May 30 16:04 213000_ggs_Linux_x64_PostgreSQL_64bit.zip
-rw-rw-rw- 1 postgres postgres 381552640 Aug  5  2021 ggs_Linux_x64_PostgreSQL_64bit.tar
-rw-r--r-- 1 postgres postgres      2409 Aug 11  2021 OGG-21.3.0.0-README.txt
-rw-r--r-- 1 postgres postgres    306395 Aug 11  2021 oracle-goldengate-release-notes_21.3.pdf
[root@oradb1 oggsoft]# $ tar -xvf ggs_Linux_x64_PostgreSQL_64bit.tar -C /ogg213$ cd /ogg213
$ ./ggsci
$ create subdirs

链接到备库注册抽取进程,失败。

GGSCI (oradb1 as ggadmin@pg_src) 9> register extract ep12025-05-30 21:47:59  WARNING OGG-00552  Database operation failed: Executing statement to create replication slot. Called from PGUTIL_registerExtract:178. ODBC error: SQLSTATE S1C00 native database error 466560. [Oracle][ODBC PostgreSQL Wire Protocol driver][PostgreSQL]ERROR: VERROR; logical decoding cannot be used while in recovery(File logical.c; Line 113; Routine CheckLogicalDecodingRequirements;.

链接到主库注册抽取进程,成功。

GGSCI (oradb1 as ggadmin@pg_src) 10> dblogin sourcedb pg_src1 userid ggadmin password Bai_yun1232025-05-30 21:52:04  INFO    OGG-03036  Database character set identified as UTF-8. Locale: en_US.UTF-8.2025-05-30 21:52:04  INFO    OGG-03037  Session character set identified as UTF-8.
Successfully logged into database.GGSCI (oradb1 as ggadmin@pg_src1) 11> register extract ep12025-05-30 21:52:16  INFO    OGG-25355  Successfully created replication slot 'ep1_831e5a3f6113dbb2' for Extract group 'EP1' in database 'testdb'.GGSCI (oradb1 as ggadmin@pg_src1) 12> edit param ep1GGSCI (oradb1 as ggadmin@pg_src1) 13> view param ep1extract ep1
setenv(PGCLIENTENCODING = "UTF8")
setenv(ODBCINI="/etc/odbc.ini" )
sourcedb testdb, userid ggadmin, password Bai_yun123
exttrail ./dirdat/e1
discardfile ./dirrpt/ep1.dsc
table public.tab1;

启动进程失败:

2025-05-30 22:13:22  ERROR   OGG-00551  Database operation failed: Couldn't connect to testdb. ODBC error: SQLSTATE IM002 native database error 0. [DataDirect][ODBC lib] D
ata source name not found and no default driver specified.2025-05-30 22:13:22  ERROR   OGG-01668  PROCESS ABENDING.

修改
sourcedb pg_src1, userid ggadmin, password Bai_yun123


2025-05-30 22:16:24  ERROR   OGG-25516  Oracle GoldenGate capture using LIBPQ client library version as 90,401 which is incompatible with the connected PostgreSQL server v
ersion 121,400 for streaming the log record. The LIBPQ client library version must be the same as or bigger than, that of the connected PostgreSQL server library version.Source Context :SourceModule            : [ggvam.gen]SourceID                : [../gglib/ggvam/cvamgen.cpp]SourceMethod            : [vamInitialize]SourceLine              : [536]ThreadBacktrace         : [14] elements: [/ogg213/libgglog.so(CMessageContext::AddThreadContext())]: [/ogg213/libgglog.so(CMessageFactory::CreateMessage(CSourceContext*, unsigned int, ...))]: [/ogg213/libgglog.so(_MSG_String_Int32(CSourceContext*, int, char const*, int, CMessageFactory::MessageDisposition))]: [/ogg213/extract(com_goldengate_vam::CVamGen::vamInitialize())]: [/ogg213/extract()]: [/ogg213/extract(ggs::er::VAMDataSource::finalizeConfiguration())]: [/ogg213/extract(ggs::gglib::ggapp::ReplicationContext::finalizeConfiguration())]: [/ogg213/extract()]: [/ogg213/extract(ggs::gglib::MultiThreading::MainThread::ExecMain())]: [/ogg213/extract(ggs::gglib::MultiThreading::Thread::RunThread(ggs::gglib::MultiThreading::Thread::ThreadArgs*))]: [/ogg213/extract(ggs::gglib::MultiThreading::MainThread::Run(int, char**))]: [/ogg213/extract(main)]: [/lib64/libc.so.6(__libc_start_main)]: [/ogg213/extract()]2025-05-30 22:16:24  ERROR   OGG-00145  Call to VAMInitialize returned with error status 16002.2025-05-30 22:16:24  ERROR   OGG-01668  PROCESS ABENDING.
http://www.xdnf.cn/news/10053.html

相关文章:

  • 使用Vditor将Markdown文档渲染成网页(Vite+JS+Vditor)
  • 鲲鹏Arm+麒麟V10,国产化信创 K8s 离线部署保姆级教程
  • PyTorch中nn.Module详解
  • C#进阶-ASP.NET WebForms调用ASMX的WebService接口
  • 职坐标精选嵌入式AI物联网开源项目
  • allWebPlugin中间件VLC专用版之截图功能介绍
  • svg的制作与动态效果的开发使用
  • 京东热点缓存探测系统JDhotkey架构剖析
  • 鸿蒙OSUniApp 移动端直播流播放实战:打造符合鸿蒙设计风格的播放器#三方框架 #Uniapp
  • AI入门示例
  • 深入解析AQS:Java并发核心框架
  • 宝塔部署 Vue + NestJS 全栈项目
  • 单片机寄存器的四种主要类型!
  • AWS Transit Gateway实战:构建DMZ隔离架构,实现可控的网络互通
  • 模块化设计,static和extern(面试题常见)
  • 2025.5.30工作总结
  • ubuntu20.04安装教程(图文详解)
  • LangChain-结合魔塔社区modelscope的embeddings实现搜索
  • Java八股文——Java基础「概念篇」
  • azure web app创建分步指南
  • 从虚拟化到云原生与Serverless
  • CSS 渐变完全指南:从基础概念到实战案例(线性渐变/径向渐变/重复渐变)
  • 异步并发控制代码详细分析
  • (c++)string的模拟实现
  • 【Office】Excel两列数据比较方法总结
  • 基于大模型预测的FicatIII-IV期股骨头坏死综合治疗研究报告
  • 多模态大语言模型arxiv论文略读(100)
  • LNMP环境中php7.2升级到php7.4
  • Android Native 之 adbd进程分析
  • 视频监控汇聚平台EasyCVR安防小知识:如何通过视频融合平台解决信息孤岛问题?