GoldenGate for win安裝配置

lovestanford發表於2015-07-26


1.GoldenGate軟體的安裝:
下載windows版的GoldenGate介質——V18162-01.zip,解壓到ggs目錄
C:\>cd ggs

C:\ggs>install addservice addevents

Oracle GoldenGate messages installed successfully.
Service 'GGSMGR' created.

Install program terminated normally.

C:\ggs>ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 10.4.0.19 Build 002
Windows (optimized), Oracle 10 on Sep 18 2009 15:54:55

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

 

GGSCI (wangyj) 1> create subdirs

Creating subdirectories under current directory C:\ggs

Parameter files                C:\ggs\dirprm: created
Report files                   C:\ggs\dirrpt: created
Checkpoint files               C:\ggs\dirchk: created
Process status files           C:\ggs\dirpcs: created
SQL script. files               C:\ggs\dirsql: created
Database definitions files     C:\ggs\dirdef: created
Extract data files             C:\ggs\dirdat: created
Temporary files                C:\ggs\dirtmp: created
Veridata files                 C:\ggs\dirver: created
Veridata Lock files            C:\ggs\dirver\lock: created
Veridata Out-Of-Sync files     C:\ggs\dirver\oos: created
Veridata Out-Of-Sync XML files C:\ggs\dirver\oosxml: created
Veridata Parameter files       C:\ggs\dirver\params: created
Veridata Report files          C:\ggs\dirver\report: created
Veridata Status files          C:\ggs\dirver\status: created
Veridata Trace files           C:\ggs\dirver\trace: created
Stdout files                   C:\ggs\dirout: created


2.環境資訊
source:
OS wangyj
ip 192.168.234.1
sid orcl
dml schema ggs
ddl schema ggsddl
GoldenGate C:\ggs

target:
OS byfree_x64
ip 192.168.234.112
sid orcl2
dml schema ggs
ddl schema ggsddl
GoldenGate C:\ggs

檢查source和target DB最小附加日誌模式:
SQL> select SUPPLEMENTAL_LOG_DATA_MIN from v$database;
SUPPLEME
--------
YES

如果沒有開啟資料庫的最小附加日誌,則透過以下語句開啟
SQL> alter database add supplemental log data;

3.source的設定(DML)
To capture key values with ADD TRANDATA
C:\ggs>ggsci

GGSCI (wangyj) 1> dblogin userid ggs password ggs

GGSCI (wangyj) 2> add trandata ggs.*

GGSCI (wangyj) 3> edit param mgr     (ggs服務埠設定)
輸入:port 7809

GGSCI (wangyj) 4> add extract ext1,tranlog,begin now

GGSCI (wangyj) 5> edit param ext1          (ext1必須與上一命令使用相同名稱——extract程式)
輸入如下內容:
extract ext1
userid ggs,password ggs
rmthost 192.168.234.112, mgrport 7809
rmttrail c:\ggs\dirdat\r1
dynamicresolution
gettruncates
table ggs.*;

(以上設定的兩個引數檔案預設放置於C:\ggs\dirprm中)

GGSCI (wangyj) 6> add rmttrail C:\ggs\dirdat\r1 extract ext1

GGSCI (wangyj) 7> start mgr

GGSCI (wangyj) 8> start ext1

檢視程式的執行情況
GGSCI (wangyj) 9> info all
Program     Status      Group       Lag           Time Since Chkpt

MANAGER     RUNNING
EXTRACT     RUNNING     EXT1        00:00:00      95:14:49

這裡的RUNNING分別表示ggs服務和捕獲程式執行正常。如沒正常RUNNING,可檢視C:\ggs\ggserr.log日誌。

4.target的設定(DML)
GGSCI (byfree_x64) 1> edit param mgr
輸入如下內容:
PORT 7809
DYNAMICPORTLIST 7840-7850

GGSCI (byfree_x64) 2> ADD replicat rep1 EXTTRAIL c:\ggs\dirdat\r1,nodbcheckpoint

GGSCI (byfree_x64) 3> edit param rep1
輸入如下內容:
replicat rep1
userid ggs,password ggs
assumetargetdefs
reperror default,discard
discardfile c:\oradata\repsz.dsc,append,megabytes 100
map ggs.*, target ggs.*;

GGSCI (byfree_x64) 4> start mgr

GGSCI (byfree_x64) 5> start rep1

GGSCI (byfree_x64) 6> info all
Program     Status      Group       Lag           Time Since Chkpt

MANAGER     RUNNING
REPLICAT    RUNNING     REP1        00:00:00      92:06:53

如沒正常RUNNING,可檢視C:\ggs\ggserr.log日誌。

至此,GoldenGate的單向DML同步已配置成功,可透過insert into、update等測試同步效果了!

5.source的設定(DDL)
建立ggsddl使用者
GGSCI (wangyj) 1> edit param globals
輸入如下內容:
GGSCHEMA ggsddl

C:\ggs>sqlplus / as sysdba

SQL> @marker_setup.sql
輸入:ggsddl

SQL> @ddl_setup.sql
enter schema:ggsddl
choose installation mode: INITIALSETUP

SQL> @role_setup.sql
SQL> grant GGS_GGSUSER_ROLE to ggsddl;

SQL> @ddl_enable.sql

GGSCI (wangyj) 2> add extract extddl,tranlog,begin now

GGSCI (wangyj) 3> edit param extddl
輸入如下內容:
extract extddl
SETENV (ORACLE_SID=orcl)
userid ggsddl, password ggsddl
rmthost 192.168.234.112, mgrport 7809
rmttrail c:\ggs\dirdat\r1
dynamicresolution
gettruncates
DDL include all
table ggsddl.*;

GGSCI (wangyj) 4> start extddl         (開啟ddl捕獲程式)

GGSCI (wangyj) 5> info all
Program     Status      Group       Lag           Time Since Chkpt

MANAGER     RUNNING
EXTRACT     RUNNING     EXTDDL        00:00:00      95:14:49

如沒正常RUNNING,可檢視C:\ggs\ggserr.log日誌。

6.target的設定(DDL)
建立ggsddl使用者
GGSCI (byfree_x64) 1> edit param globals
輸入如下內容:
GGSCHEMA ggsddl

GGSCI (byfree_x64) 2> ADD replicat repddl EXTTRAIL c:\ggs\dirdat\r1,nodbcheckpoint

GGSCI (byfree_x64) 3> edit param repddl
輸入如下內容:
replicat repddl
userid ggsddl,password ggsddl
assumetargetdefs
reperror default,discard
ddl include all
discardfile c:\oradata\repddl.dsc,append,megabytes 100
map ggsddl.*, target ggsddl.*;

GGSCI (byfree_x64) 4> start repddl

GGSCI (byfree_x64) 5> info all
Program     Status      Group       Lag           Time Since Chkpt

MANAGER     RUNNING
REPLICAT    RUNNING     REPDDL        00:00:00      92:06:53

如沒正常RUNNING,可檢視C:\ggs\ggserr.log日誌。

完成第5、6步的配置,即可測試DDL SQL。

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

相關文章