使用GoldenGate 实现Oracle for Oracle 单向数据同步(3)

GGSCI (localhost.localdomain) 32> INFO ALL
 
Program    Status      Group      Lag at Chkpt  Time Since Chkpt
 
MANAGER    RUNNING                                         
EXTRACT    RUNNING    EORAKK      00:00:00      00:00:06

目标端,配置REPLICAT

安装checkpoint表

配置checkpoint表的名称

GGSCI (localhost.localdomain) 33> EDIT PARAMS ./GLOBALS
 
 
HECKPOINTTABLE system.ggschkpt

生成checkpoint表

GGSCI (localhost.localdomain) 1> DBLOGIN USERID system, PASSWORD oracle
Successfully logged into database.
 
GGSCI (localhost.localdomain) 2> ADD CHECKPOINTTABLE
 
No checkpoint table specified, using GLOBALS specification (system.ggschkpt)...
 
Successfully created checkpoint table system.ggschkpt.
 
GGSCI (localhost.localdomain) 3>

添加Replicat

GGSCI (localhost.localdomain) 3> ADD REPLICAT RORAKK, EXTTRAIL ./dirdat/KK
REPLICAT added.

创建Replicat的参数文件

GGSCI (localhost.localdomain) 4> EDIT PARAMS RORAKK
 
 
--
-- Change Delivery parameter file to apply
-- TCUSTMER and TCUSTORD Changes
--
REPLICAT RORAKK
USERID system, PASSWORD oracle
HANDLECOLLISIONS
ASSUMETARGETDEFS
DISCARDFILE ./dirrpt/RORAKK.DSC, PURGE
MAP scott.tcustmer, TARGET scott.tcustmer;
MAP scott.tcustord, TARGET scott.tcustord;

启动Replicat

GGSCI (localhost.localdomain) 5> start replicat rorakk
 
Sending START request to MANAGER ...
REPLICAT RORAKK starting

验证结果

GGSCI (localhost.localdomain) 6> info replicat rorakk
 
REPLICAT  RORAKK    Last Started 2015-08-22 15:49  Status RUNNING
Checkpoint Lag      00:00:00 (updated 00:00:08 ago)
Log Read Checkpoint  File ./dirdat/KK000000
                    First Record  RBA 1050

验证数据同步

在源数据库,执行如下脚本,对两个表进行insert、update、delete操作

[oracle@localhost ogg]$ sqlplus scott/tiger
 
SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 11 17:58:17 2015
 
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
 
 
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
 
SQL> @/u01/app/ogg/demo_ora_misc.sql

查看源表中的数据

SQL> select count(*) from tcustmer;
 
  COUNT(*)
----------
    5
 
SQL> select count(*) from tcustord;
 
  COUNT(*)
----------
    3

查看目的表的数据

SQL> select count(*) from tcustmer;
 
  COUNT(*)
----------
    5
 
SQL> select count(*) from tcustord;
 
  COUNT(*)
----------
    3

数据已同步

Oracle GoldenGate 学习教程一:介绍和安装 

Oracle GoldenGate 学习教程二、配置和使用 

Oracle GoldenGate 学习教程三、加密 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/691dce232d553094db55b1e93106d7fd.html