GoldenGate異種資料庫之間的複製

如此相信發表於2022-03-09

GoldenGate異種資料庫之間的複製

本文介紹的是從將資料從Oracle同步到SQLServer

假設源資料庫oracle已經有了一個用於GG環境的ggs使用者
Oracle GoldenGate的安裝已經在以前的blog中有過介紹,這裡不再介紹針對於Oracle資料庫GoldenGate的安裝
ggs使用者已經有了足夠的許可權執行GoldenGate
先建立兩張表用於測試
  create table emp as select * from scott.emp where 1 = 0;
  create table dept as select * from scott.dept where 1 = 0;
在ggsci下建立一個用於建立資料定義檔案的引數檔案defgen, 內容如下:
   edit param defgen
   DEFSFILE dirdef/source.def, PURGE
   USERID GGS, PASSWORD xxxx
   TABLE GGS.EMP;
   TABLE GGS.DEPT;
生成的引數檔案位於dirprm下
退出ggsci,執行源定義生成器
defgen paramfile dirprm/defgen.prm
/*******************
d:\ggs>defgen paramfile dirprm/defgen.prm

***********************************************************************
        Oracle GoldenGate Table Definition Generator for Oracle
      Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230
        Windows (optimized), Oracle 11g on Apr 23 2012 05:45:18

Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.


                    Starting at 2013-07-11 14:36:22
***********************************************************************

Operating System Version:
Microsoft Windows 7 , on x86
Version 6.1 (Build 7600: )

Process id: 1516

***********************************************************************
**            Running with the following parameters                  **
***********************************************************************
DEFSFILE dirdef/source.def,PURGE
userid ggs, password ***
table ggs.emp;
Retrieving definition for GGS.EMP

2013-07-11 14:36:22  WARNING OGG-00869  No unique key is defined for table 'EMP'
. All viable columns will be used to represent the key, but may not guarantee un
iqueness.  KEYCOLS may be used to define the key.

table ggs.dept;
Retrieving definition for GGS.DEPT

2013-07-11 14:36:22  WARNING OGG-00869  No unique key is defined for table 'DEPT
'. All viable columns will be used to represent the key, but may not guarantee u
niqueness.  KEYCOLS may be used to define the key.



Definitions generated for 2 tables in dirdef/source.def


d:\ggs>
*******************/
這樣就生成了我們需要同步的表的定義描述檔案
Oracle資料庫的GoldenGate完成後,需要配置SQLServer,即目標端的GoldenGate
SQLServer端的GoldenGate版本資訊
Oracle GoldenGate Command Interpreter for SQL Server
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230
Windows x64 (optimized), Microsoft SQL Server on Apr 23 2012 06:56:36 

GGSCI (chenyj-WorkPC) 1> create subdirs
Creating subdirectories under current directory D:\ggs
Parameter files                D:\ggs\dirprm: already exists
Report files                   D:\ggs\dirrpt: created
Checkpoint files               D:\ggs\dirchk: created
Process status files           D:\ggs\dirpcs: created
SQL script. files               D:\ggs\dirsql: created
Database definitions files     D:\ggs\dirdef: created
Extract data files             D:\ggs\dirdat: created
Temporary files                D:\ggs\dirtmp: created
Stdout files                   D:\ggs\dirout: created
GGSMGR已經被安裝為windows服務,安裝過程
與oracle版本相同
在GGSCI中啟動mgr時碰到了錯誤:
GGSCI (chenyj-WorkPC) 4> start mgr
Process creation error: WIN32 API CALL CreateProcess failed 740 (請求的操作需要
提升。)
因而我直接從服務列表中啟動它

GGSCI (chenyj-WorkPC) 5> info all
Program     Status      Group       Lag at Chkpt  Time Since Chkpt
MANAGER     RUNNING
截至到目前我們已經安裝好了源端(Oracle)與目標端(SQL Server)的GoldenGate


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

相關文章