Ref:
GoldenGate SEQUENCE 同步
最近用GoldenGate實現了Windows Oracle10g 到Linux Oracle11g的遷移。
記錄一下遇到的一個問題:
資料同步到Oracle11g後,測試發現某些應用插入資料時報主鍵衝突。經調查發現是一些利用sequence做主鍵的表有問題,sequence的最大值小於主鍵的最大值。對比來源資料庫和目標資料庫的sequence發現,有些sequence的值沒有同步到目標資料庫。
查詢GoldenGate的官方文檔後發現可以用FLUSH SEQUENCE的方式來同步sequence:
GGSCI>FLUSH SEQUENCE scott.seq*
Oracle GoldenGate
Windows and UNIX Reference Guide
11g Release 1 Patch Set 1 (11.1.1.1)
E21512-02
中第82頁記錄了這段描述:
Use FLUSH SEQUENCE immediately after you start Extract for the first time during an initia
synchronization or a re-synchronization. This command updates an Oracle sequence so
that initial redo records are available at the time that Extract starts to capture transaction
data. Normally, redo is not generated until the current cache is exhausted. The flush give
Replicat an initial start point with which to synchronize to the correct sequence value on
the target system. From then on, Extract can use the redo that is associated with the usua
cache reservation of sequence values.
The following database procedures are used by this command and normally are installed
by running the sequence.sql script when Oracle GoldenGate is installed.
Before using FLUSH SEQUENCE, issue the DBLOGIN command as the database user that has
EXECUTE privilege on the updateSequence procedure.
To use this command, the GGSCHEMA parameter must be used in the GLOBALS file to specify
the schema in which the sequence.sql procedure is installed. This can be the same schema
that is used for the Oracle GoldenGate DDL support and any other database objects that
are owned by Oracle GoldenGate.
沒有留言:
張貼留言