--
新增一个远程队列,位置为在TargetDB的d:\\ggs\\dirdat\\r1,是抽取进程ext1抽取的数据队列,注意和抽取进程中配置的rmttrail d:\\ggs\\dirdat\\r1一致。 开启所有进程
GGSCI (PONY) 11> start mgr
Starting Manager as service ('GGSMGR')... Service started.
GGSCI (PONY) 14> start ext1
Sending START request to MANAGER ('GGSMGR') ... EXTRACT EXT1 starting
查看进程的运行情况
GGSCI (PONY) 185> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXT1 00:00:00 00:00:06
OK,Mgr进程和EXT进程都已经正常运行 SouceDB端的配置完成。
3.2.2 配置TargetDB的GoldenGate
1.配置mgr参数
GGSCI (PONY) 2> edit param mgr
此时系统自动会新建一个mgr的参数文件,填入以下内容后保存 PORT 7809
DYNAMICPORTLIST 7840-7850 --mgr进程使用的TCP/IP端口侦听请求 接受远端队列的端口列表。
2.新增一个复制进程
GGSCI (PONY) 2>ADD replicat rep1 EXTTRAIL d:\\ggs\\dirdat\\r1, nodbcheckpoint
--新增一个复制进程,将抽取到队列中的文件解析后写进TargetDB
3.配置复制进程
9
GGSCI (PONY) 2> edit param rep1
此时系统会自动新建一个参数文件,填入一下内容后保存
replicat rep1
userid goldengate,password goldengate assumetargetdefs
reperror default,discard
discardfile D:\\oradata\\discard\\repsz.dsc,append,megabytes 100 gettruncate
map sajet.*, target sajet.*; map sj.*, target sj.*;
map lang.*, target lang.*; map smt.*, target smt.*;
--复制进程名
登入TargetDB的账号和密码
两台DB数据结构一致则使用此参数
如果复制出错,则继续,并将错误放进discardfile中 复制truncate操作
复制的源表为sajet,sj,lang,smt用户下的所有表,目标为TargetDB中对用用户下的所有表
开启mgr和rep进程
GGSCI (PONY) 20> start mgr
Starting Manager as service ('GGSMGR')... Service started.
GGSCI (PONY) 21> start rep1
Sending START request to MANAGER ('GGSMGR') ... REPLICAT REP1 starting
查看进程的运行情况
GGSCI (PONY) 22> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING REP1 00:00:00 00:00:07
10
OK,MGR进程和REP进程运行正常
至此,两台DB的GoldenGate都已经配置完成。
3.3 测试DML操作
首先往SourceDB中插入一行
C:\\Documents and Settings\\Administrator>sqlplus
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Mar 8 15:33:47 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter user-name: sajet/tech@hitron
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Data Mining options
SQL> insert into sajet.sys_emp values (10000786,'TEST1','TEST1','','TEST','10000 27','','Y','',0,'',0,'','') 2 ;
1 row created. SQL> commit 2 ;
Commit complete.
看看TargetDB中是否有同样的记录存在呢 SQL> connect sajet/tech@goldenga Connected.
SQL> select count (*) from sajet.sys_emp 2 where emp_id=10000786;
COUNT(*) ---------- 1
同步过来了。
我们可以看看EXT1进程的相关统计信息
11
GGSCI (sajet-project) 189> stats ext1
Sending STATS request to EXTRACT EXT1 ...
Start of Statistics at 2010-03-08 15:47:51.
DDL replication statistics (for all trails):
*** Total statistics since extract started ***
Operations 40.00 Mapped operations 28.00 Unmapped operations 0.00 Other operations 12.00 Excluded operations 0.00
Output to d:\\ggs\\dirdat\\r1:
Extracting from GOLDENGATE.GGS_MARKER to GOLDENGATE.GGS_MARKER:
*** Total statistics since 2010-03-05 09:51:51 ***
No database operations have been performed.
*** Daily statistics since 2010-03-08 00:00:00 ***
No database operations have been performed.
*** Hourly statistics since 2010-03-08 15:00:00 ***
No database operations have been performed.
*** Latest statistics since 2010-03-05 09:51:51 ***
No database operations have been performed.
Extracting from SAJET.GOLDEGATETEST to SAJET.GOLDEGATETEST:
*** Total statistics since 2010-03-05 09:51:51 ***
Total inserts 3.00 Total updates 0.00 Total deletes 0.00 Total truncates 2.00 Total discards 0.00
12