godengate 双中心时,如何保证SQL 执行的顺序?
dbdao吧
全部回复
仅看楼主
level 3
zyc_oracle 楼主
godengate 双中心时,如何保证SQL 执行的顺序?
如:A地: update table1 set sale=110 where id = 1; --如:更新前sale = 100
B地:update table1 set sale=120 where id = 1;
A地:commit; --sale = 110
B地:commit; --sale = 120 ;A地与B地提交的时间间隔很短,小于同步时间
  A地同步到B地; --B地的sale = 120
  B地同步到A地; --A地的sale = 110
这样就造成了两边数据不一致,如何解决这个问题 呢?
2016年04月08日 06点04分 1
level 13
Preventing Data Looping
In a bidirectional configuration, SQL changes that are replicated from one system to another must be prevented from being replicated back to the first system. Otherwise, it moves back and forth in an endless loop, as in this example:
A user application updates a row on system A.
Extract extracts the row on system A and sends it to system B.
Replicat updates the row on system B.
Extract extracts the row on system B and sends it back to system A.
The row is applied on system A (for the second time).
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 order for the Extract process to ignore them.
9.3.1 Preventing the Capture of Replicat Operations
Depending on which database you are using, you may or may not need to provide explicit instructions to prevent the capture of Replicat operations.
9.3.1.1 Preventing the Capture of Replicat Transactions (Oracle)
To prevent the capture of SQL that is applied by Replicat to an Oracle database, there are different options depending on the Extract capture mode:
When Extract is in classic or integrated capture mode, use the TRANLOGOPTIONS parameter with the EXCLUDETAG tag option. This parameter directs the Extract process to ignore transactions that are tagged with the specified redo tag. See Section 9.3.2 to set the tag value.
When Extract is in classic capture mode, use the Extract TRANLOGOPTIONS parameter with the EXCLUDEUSER or EXCLUDEUSERIDoption to exclude the user name or ID that is used by Replicat to apply transactions. Multiple EXCLUDEUSER statements can be used. The specified user is subject to the rules of the GETREPLICATES or IGNOREREPLICATES parameter. See Section 9.3.1.3 for more information.
9.3.1.2 Preventing Capture of Replicat Transactions (Teradata)
To prevent the capture of SQL that is applied by Replicat to a Teradata database, set the Replicat session to override Teradata replication. Use the following SQLEXEC statements at the root level of the Replicat parameter file:
SQLEXEC 'SET SESSION OVERRIDE REPLICATION ON;'SQLEXEC 'COMMIT;'
These SQLEXEC statements execute a procedure that sets the Replicat session automatically at startup.
9.3.1.3 Preventing Capture of Replicat Transactions (Other Databases)
To prevent the capture of SQL that is applied by Replicat to other database types (including Oracle, if Extract operates in classic capture mode), use the following parameters:
GETAPPLOPS | IGNOREAPPLOPS: Controls whether or not data operations (DML) produced by business applications except Replicatare included in the content that Extract writes to a specific trail or file.
GETREPLICATES | IGNOREREPLICATES: Controls whether or not DML operations produced by Replicat are included in the content that Extract writes to a specific trail or file.
FYI
https://docs.oracle.com/goldengate/1212/gg-winux/GWUAD/wu_bidirectional.htm#GWUAD302
2016年04月10日 13点04分 2
多谢你的回答,但你说的这个是防止循环,而我说的问题是因为双中心,两边都在更新同一条数据,因OGG转输时间差导至的数据不一至问题。
2016年06月17日 08点06分
@zyc_oracle 两边都在更新同一条数据 就是循环问题,不要变换概念。
2016年06月18日 04点06分
再次感谢你的回复,但我说的确实不是循环更新的问题,而是2边都在更新(双业务中心),这个更新时间差很少,可能小于1秒,这时远程的更新还没有传过来,本地更新时取的是旧数据,而非最新的数据,这个问题该如何解决?
2016年06月23日 07点06分
@zyc_oracle 本地更新时取的是旧数据,而非最新的数据,这个问题该如何解决? 那就变成 同步延迟问题了, 延迟问题 可以通过优化解决, 或者优化到一定地步无法进一步优化了,那么是无可避免的。
2016年06月28日 08点06分
level 5
楼主,问题解决了吗,我也在想这个问题
2016年04月20日 06点04分 4
1