说明:本文为Oracle GoldenGate进程模式转换指定手册
模式:应用进程非集成模式转协同模式(nonintegrated转coordinated)
温馨提示:如果您发现本文哪里写的有问题或者有更好的写法请留言或私信我进行修改优化
温馨提示
※ 如果源端“抓取”进程不需要合并的话源端不用做任何改动(如果想合并的话可以使用eventactions(stop)命令实现多个进程在同一点处停止)
※ 如果源端“投递”进程不需要合并的话源端不用做任何改动(如果想合并的话可以使用eventactions(stop)命令实现多个进程在同一点处停止)
※ 如果目标端“复制”进程不需要合并的话直接执行STOP命令即可,如果想合并的话可以使用eventactions(ignore,stop)命令实现多个进程在同一点处停止,从而干净的将多个replicate进程合并到一个新coordinated进程中
※ 原来的trail文件可以继续使用,转coordinated模式不涉及trail格式的更改
※ 目标端需要重新配置replicat进程,配置前需要停止旧的传统模式的replicat进程
各模式特点概述
组类型 | 模式名称 | 简要说明 |
extract | classic(经典模式) | 在经典捕获模式下,Oracle GoldenGate Extract进程从源系统上的Oracle重做或归档日志文件或备用系统上附带的归档日志中捕获数据更改 |
integrated(集成模式) | 在集成捕获模式下,Oracle GoldenGate Extract流程与数据库日志挖掘服务器直接交互,以逻辑更改记录(LCR)的形式接收数据更改 | |
replicate | integrated(集成模式) | 在集成模式下,复制过程利用了Oracle数据库中可用的应用处理功能。 |
nonintegrated(非集成模式) 又叫classic(经典模式) | 在非集成模式下,复制过程是一个单线程进程,它使用标准SQL将数据应用于目标表 | |
coordinated(协作模式) | 经典模式和协作模式之间的区别在于,复制在协作模式下是多线程的。在单个Replicat实例中,多个线程独立读取跟踪并并行应用事务。每个线程都为其分配的工作负载处理过滤,映射,转换,SQL构造和错误处理。一个协调线程协调跨线程的交易帐户的线程之间的依赖关系。 |
架构图一览表
下图为:非集成模式
下图为:协同模式
实验开始
★ 实验环境
///
系统:Linux 6.3
数据库:Oracle 11gR2
OGG版本:12.3.0.1.4
源端IP:1.1.1.1
目标端IP:1.1.1.2
★ 配置并重启旧进程参数配置
///
GGSCI (rac2) 3> view param re_scott
replicat re_scott
userid ogg,password ogg
assumetargetdefs
GETTRUNCATES
reperror default,discard
ddl include mapped
ddloptions report
ddlerror default ignore retryop maxretries 3 retrydelay 5
ddlerror default discard
discardfile /ogg123/dirrpt/re_scott.desc,append,megabytes 100
trace /ogg123/dirrpt/trace.txt
dynamicresolution
allownoopupdates
map scott.*,target scott.*;
★ 等待旧复制进程自动干净的停止
///
GGSCI (rac2) 2> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT stopped RE_SCOTT 00:00:00 00:00:08
★ 依照旧的非集成模式进程参数配置新协同模式进程参数
///
GGSCI (rac2) 4> edit param re_c 【协同模式组名最多容许5个字符,因为OGG会自动给进程加nnn三位的进程序号,所以需要预留3位】
replicat re_c
userid ogg,password ogg
assumetargetdefs
GETTRUNCATES
reperror default,discard
ddl include mapped
ddloptions report
ddlerror default ignore retryop maxretries 3 retrydelay 5
ddlerror default discard
discardfile /ogg123/dirrpt/re_c.desc,append,megabytes 100
dynamicresolution
allownoopupdates
map scott.*,target scott.*,threadrange(1-9); 【此处可以设置表或用户级的可分配进程数】
map a.t,target a.t,threadrange(10-19);
★ 添加协同复制进程
///
GGSCI (rac2) 8> add replicat re_c,exttrail /ogg123/dirdat/ps,extseqno 4,extrba 1475,coordinated maxthreads 500,checkpointtable ogg.checkpoint 【最大子进程500,实际没有测试】
★ 启动协同复制进程
///
GGSCI (rac2) 12> start re_c
★ 查看运行状态
///
GGSCI (rac2) 13> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING RE_C 00:00:00 00:00:00
GGSCI (rac2) 15> info *
REPLICAT RE_C Last Started 2020-03-04 14:54 Status RUNNING
COORDINATED Coordinator MAXTHREADS 99
Checkpoint Lag 00:00:00 (updated 00:00:05 ago)
Process ID 10798
Log Read Checkpoint File /ogg123/dirdat/ps000000004
2020-03-04 15:23:26.404452 RBA 6047
REPLICAT RE_C001 Last Started 2020-03-04 14:54 Status RUNNING
COORDINATED Replicat Thread Thread 1
Checkpoint Lag 00:00:00 (updated 00:00:07 ago)
Process ID 10804
Log Read Checkpoint File /ogg123/dirdat/ps000000004
2020-03-04 15:10:03.000571 RBA 6047
REPLICAT RE_C002 Last Started 2020-03-04 14:54 Status RUNNING
COORDINATED Replicat Thread Thread 2
Checkpoint Lag 00:00:00 (updated 00:00:07 ago)
Process ID 10806
Log Read Checkpoint File /ogg123/dirdat/ps000000004
2020-03-04 15:10:03.000571 RBA 6047
REPLICAT RE_C003 Last Started 2020-03-04 14:54 Status RUNNING
COORDINATED Replicat Thread Thread 3
Checkpoint Lag 00:00:00 (updated 00:00:07 ago)
Process ID 10808
Log Read Checkpoint File /ogg123/dirdat/ps000000004
2020-03-04 15:10:03.000571 RBA 6047
REPLICAT RE_C004 Last Started 2020-03-04 14:54 Status RUNNING
COORDINATED Replicat Thread Thread 4
Checkpoint Lag 00:00:00 (updated 00:00:07 ago)
Process ID 10809
Log Read Checkpoint File /ogg123/dirdat/ps000000004
2020-03-04 15:10:03.000571 RBA 6047
REPLICAT RE_C005 Last Started 2020-03-04 14:54 Status RUNNING
COORDINATED Replicat Thread Thread 5
Checkpoint Lag 00:00:00 (updated 00:00:07 ago)
Process ID 10810
Log Read Checkpoint File /ogg123/dirdat/ps000000004
2020-03-04 15:10:03.000571 RBA 6047
REPLICAT RE_C006 Last Started 2020-03-04 14:54 Status RUNNING
COORDINATED Replicat Thread Thread 6
Checkpoint Lag 00:00:00 (updated 00:00:07 ago)
Process ID 10811
Log Read Checkpoint File /ogg123/dirdat/ps000000004
2020-03-04 15:10:03.000571 RBA 6047
REPLICAT RE_C007 Last Started 2020-03-04 14:54 Status RUNNING
COORDINATED Replicat Thread Thread 7
Checkpoint Lag 00:00:00 (updated 00:00:07 ago)
Process ID 10812
Log Read Checkpoint File /ogg123/dirdat/ps000000004
2020-03-04 15:10:03.000571 RBA 6047
REPLICAT RE_C008 Last Started 2020-03-04 14:54 Status RUNNING
COORDINATED Replicat Thread Thread 8
Checkpoint Lag 00:00:00 (updated 00:00:07 ago)
Process ID 10814
Log Read Checkpoint File /ogg123/dirdat/ps000000004
2020-03-04 15:10:03.000571 RBA 6047
REPLICAT RE_C009 Last Started 2020-03-04 14:54 Status RUNNING
COORDINATED Replicat Thread Thread 9
Checkpoint Lag 00:00:00 (updated 00:00:07 ago)
Process ID 10815
Log Read Checkpoint File /ogg123/dirdat/ps000000004
2020-03-04 15:10:03.000571 RBA 6047
★ 查看目标端re_c进程的并行子程序情况
///
[root@rac2 ~]# ps -ef |grep re_c
oggos 10798 5773 1 14:54 ? 00:00:05 /ogg123/replicat PARAMFILE /ogg123/dirprm/re_c.prm REPORTFILE /ogg123/dirrpt/RE_C.rpt PROCESSID RE_C
oggos 10804 10798 0 14:54 ? 00:00:00 /ogg123/replicat PARAMFILE /ogg123/dirprm/re_c.prm REPORTFILE /ogg123/dirrpt/RE_C001.rpt PROCESSID RE_C001 THREADID 1 PARAMCRC 504797563 COORDPORT 0 COORDPID 10798
oggos 10806 10798 0 14:54 ? 00:00:00 /ogg123/replicat PARAMFILE /ogg123/dirprm/re_c.prm REPORTFILE /ogg123/dirrpt/RE_C002.rpt PROCESSID RE_C002 THREADID 2 PARAMCRC 504797563 COORDPORT 0 COORDPID 10798
oggos 10808 10798 0 14:54 ? 00:00:00 /ogg123/replicat PARAMFILE /ogg123/dirprm/re_c.prm REPORTFILE /ogg123/dirrpt/RE_C003.rpt PROCESSID RE_C003 THREADID 3 PARAMCRC 504797563 COORDPORT 0 COORDPID 10798
oggos 10809 10798 0 14:54 ? 00:00:00 /ogg123/replicat PARAMFILE /ogg123/dirprm/re_c.prm REPORTFILE /ogg123/dirrpt/RE_C004.rpt PROCESSID RE_C004 THREADID 4 PARAMCRC 504797563 COORDPORT 0 COORDPID 10798
oggos 10810 10798 0 14:54 ? 00:00:00 /ogg123/replicat PARAMFILE /ogg123/dirprm/re_c.prm REPORTFILE /ogg123/dirrpt/RE_C005.rpt PROCESSID RE_C005 THREADID 5 PARAMCRC 504797563 COORDPORT 0 COORDPID 10798
oggos 10811 10798 0 14:54 ? 00:00:00 /ogg123/replicat PARAMFILE /ogg123/dirprm/re_c.prm REPORTFILE /ogg123/dirrpt/RE_C006.rpt PROCESSID RE_C006 THREADID 6 PARAMCRC 504797563 COORDPORT 0 COORDPID 10798
oggos 10812 10798 0 14:54 ? 00:00:00 /ogg123/replicat PARAMFILE /ogg123/dirprm/re_c.prm REPORTFILE /ogg123/dirrpt/RE_C007.rpt PROCESSID RE_C007 THREADID 7 PARAMCRC 504797563 COORDPORT 0 COORDPID 10798
oggos 10814 10798 0 14:54 ? 00:00:00 /ogg123/replicat PARAMFILE /ogg123/dirprm/re_c.prm REPORTFILE /ogg123/dirrpt/RE_C008.rpt PROCESSID RE_C008 THREADID 8 PARAMCRC 504797563 COORDPORT 0 COORDPID 10798
oggos 10815 10798 0 14:54 ? 00:00:00 /ogg123/replicat PARAMFILE /ogg123/dirprm/re_c.prm REPORTFILE /ogg123/dirrpt/RE_C009.rpt PROCESSID RE_C009 THREADID 9 PARAMCRC 504797563 COORDPORT 0 COORDPID 10798
root 11058 11012 0 15:02 pts/4 00:00:00 grep re_c
[root@rac2 ~]#
★ 配置完成,以下为测试阶段
///
源端对scott用户执行DDL/DML进行测试时无异常,测试通过
★ 相关文章
///
※ 《reference-oracle-goldengate.pdf》
※ https://docs.oracle.com/goldengate/c1230/gg-winux/GWUAD/performing-administrative-operations.htm#GWUAD1086
※ 如果您觉得文章写的还不错, 别忘了在文末给作者点个赞哦 ~
over