oracle-oracle goldengate零停机初始化的技巧

      在实施goldengate过程中,初始化的方案选择是一个重要的环节,尤其对一个7*24小时的系统环境来讲。一个出色的    goldengate的实施不应该以停机时间作为代价,合适的初始化方法完全可以做到零停机。 

      如果事务不间断进行,如何保证初始化过程中事务的完整性和数据的准确性呢(静态的初始化环境无需多讲)?实现方法还是多样的,从工作机制上来讲,归纳起来主要有2种。

     1. 利用 Keys + Handlecollisions

     2.利用 commit SCN/CSN

        Handlecollisions参数依赖于表上的Key(Primary key/Unique key)来对数据进行重复行和缺失行的处理,常在数据初始化过程中保证数据的一致性,gg文档上的初始化办法,比如initial load,都是用的这种办法。但是这种办法在实际的工程实施中是有相当大的限制。

        首先,该初始化办法性能比较糟糕,对于大型数据库来讲,并不合适。更严重的是,它有很大的缺陷性。(引自metalink doc):

1. When there is primary key update (PKUpdate), the HANDLECOLLISIONS method may lose data. The solution in the case of a primary key update is for Extract to fetch whole row by making a flashback query. However, this is not efficient and may not be possible in certain environments.

2. When a table does not have any type of key, HANDLECOLLISIONS may introduce duplicate rows in the table. One workaround is to add a primary or unique key to the target table.

3. The exact timestamp when the initial load was started may not be known (and different tables may have different start times), so it is almost inevitable that HANDLECOLLISIONS will be used for certain records un-necessarily. This could mask a real data integrity problem.

         在实际的工程实施中,个人不推荐使用基于Keys + Handlecollisions模式的初始化办法。

【 阅读全文 】