GoldenGate Oralce到MSSQL

abstractcyj發表於2013-07-17
只列出基本基本配置。GG 的基本安裝在此略過
首先必須生成oracle(源端)的表定義檔案
先寫好一個defgen檔案,然後呼叫GG安裝目錄下的defgen生成
生成的定義檔案如下:
   *+- Defgen version 2.0, Encoding GBK
*
* Definitions created/modified  2013-07-17 09:37
*
*  Field descriptions for each column entry:
*
*     1    Name
*     2    Data Type
*     3    External Length
*     4    Fetch Offset
*     5    Scale
*     6    Level
*     7    Null
*     8    Bump if Odd
*     9    Internal Length
*    10    Binary Length
*    11    Table Length
*    12    Most Significant DT
*    13    Least Significant DT
*    14    High Precision
*    15    Low Precision
*    16    Elementary Item
*    17    Occurs
*    18    Key Column
*    19    Sub Data Type
*
Database type: ORACLE
Character set ID: UTF-8
National character set ID: UTF-16
Locale: neutral
Case sensitivity: 14 14 14 14 14 14 14 14 14 14 14 14 11 14 14 14
*
Definition for table SCOTT.CUSTOMER
Record length: 996
Syskey: 0
Columns: 5
ID           64     50        0  0  0 1 0     50     50     50 0 0 0 0 1    0 1 2
FIRST_NAME   64    200       56  0  0 1 0    200    200      0 0 0 0 0 1    0 0 0
LAST_NAME    64    200      262  0  0 1 0    200    200      0 0 0 0 0 1    0 0 0
LOC          64    500      468  0  0 1 0    500    500      0 0 0 0 0 1    0 0 0
CRT_DT      192     19      974  0  0 1 0     19     19     19 0 5 0 0 1    0 0 0
End of definition

資料初始化複製程式:
源端:

      GGSCI (chenyj-WorkPC) 1> view param iniext
sourceistable
userid ggs, password ggs
rmthost 127.0.0.1,mgrport 7700
rmtfile D:\ggora-ms\ggsms\dirdat\ex
table scott.customer;

  呼叫 extract paramfile dirprm/iniext.prm reportfile dirpt/iniext.rpt
  這樣資料就傳輸到了SQLServer的GoldenGate
目標端:

   GGSCI (chenyj-WorkPC) 1> view param inirep
specialrun
end runtime
targetdb ggs_nc
extfile D:\ggora-ms\ggsms\dirdat\ex
sourcedefs D:\ggora-ms\ggsms\dirdef\source.def
map scott.customer, target dbo.customer;

呼叫replicat paramfile dirprm/inirep.prm將源端的初始資料複製進SQLServer

接下來配置即時複製程式

源端:
add extract extora1, tranlog, begin now
ADD RMTTRAIL D:\ggora-ms\ggsms\dirdat\oa, EXTRACT EXTORA1

GGSCI (chenyj-WorkPC) 1> view param extora1
extract extora1
userid ggs, password ggs
rmthost 127.0.0.1, mgrport 7700
rmttrail D:\ggora-ms\ggsms\dirdat\oa
table scott.customer;

目標端:
dblogin sourcedb ggs_nc

GGSCI (chenyj-WorkPC) 4> add checkpointtable dbo.chkpt

Successfully created checkpoint table dbo.chkpt.

GGSCI (chenyj-WorkPC) 5> add replicat msrep1,exttrail D:\ggora-ms\ggsms\dirdat\oa, checkpointtable dbo.chkpt
REPLICAT added.

GGSCI (chenyj-WorkPC) 7> view param msrep1
REPLICAT MSREP1
targetdb ggs_nc
SOURCEDEFS dirdef/source.def
MAP scott.customer, TARGET dbo.customer;


分別啟動源端的extract組oraext1與目標端的replicat組msrep1
測試。

基本複製就完成了
     

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8520577/viewspace-766456/,如需轉載,請註明出處,否則將追究法律責任。

相關文章