欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Oracle Golden Gate 双活复制避免循环复制参数

程序员文章站 2024-04-05 10:57:18
...

Oracle Golden Gate 双活复制避免循环复制参数

我简单的简绍一下goldengate的一些实用的、常用的参数。

一、双向复制避免数据循环复制的参数

首先说明一下循环复制,官网上的描述:

In a bidirectional configuration, SQL change s that are replicated from one system to
another must be prevented from being replicat ed back to the first system. Otherwise, it
moves back and forth in an endless loop, as in this example:
1. A user application updates a row on system A.
2. Extract extracts the row on system A and sends it to system B.
3. Replicat updates the row on system B.
4. Extract extracts the row on system B and sends it back to system A.
5. The row is applied on system A (for the second time).
6. This loop continues endlessly.
To prevent data loopback, you may need to provide instructions that:
● prevent the capture of SQL operations that are generated by Replicat, but enable the
capture of SQL operations that are generated by business applications if they contain
objects that are specified in the Extract parameter file.
● identify local Replicat transactions, in or der for the Extract process to ignore them.


意译:主端对数据的修改,被应用到了备端。但是备端在执行这个主端传递过来的数据改变时,又被备端的extract 进程
扑获到,并且又反给主端。然后主端又给备端,这样形成了循环复制,会一直循环下去。

一定要理解原因:主端执行修改数据的用户是和业务应用对应的用户(不是ogg用户),,但是备端在执行主端传递过来的
对数据修改的用户是ogg复制用户,也就是我前面配置的ogg 用户。(ogg schema)而实际上这个用户发起的对数据的修改
只是对主端的应用,只是复制主端的事务。而不能再被作为对数据的修改,返回给主端。所以在参数文件中加入参数
过滤掉这个用户发起的对数据的修改。

以oralce 数据库为例,说明参数如下:

Do either of the following to specify the Replicat database us er. All transactions generated
by this user will be excluded from being captured. This information is available to Extract
in the transaction record.
● Identify the Replicat database user by name with the following parameter statement
in the Extract parameter file.
TRANLOGOPTIONS EXCLUDEUSER

该参数加到主端和备端的extract 参数文件中。

例如:

USERID ogg, PASSWORD AACAAAAAAAAAAADAHBLDCCIIOIRFNEPB, ENCRYPTKEY default
TRANLOGOPTIONS EXCLUDEUSER ogg

理解这个问题的关键是搞清楚用户。这是配置双活的关键步骤。

Oracle Golden Gate 双活复制避免循环复制参数