GoldenGate配置(二)之双向复制配置



环境:

Item

Source System

Target System

Platform

Red Hat Enterprise

Linux Server release 5.4

Red Hat Enterprise

Linux Server release 5.4

Hostname

gc1

gc2

Database

Oracle 10.2.0.1

Oracle 11.2.0.1

Character Set

ZHS16GBK

ZHS16GBK

ORACLE_SID

PROD

EMREP

Listener Name/Port

LISTENER/1521

LISTENER/1521

Goldengate User

ogg

ogg

双向复制配置

说明:
此篇续接第一篇“GoldenGate配置(一)之单向复制配置”之后继续进行配置
关于上一篇,GoldenGate配置(一)之单向复制配置:点击打开链接

双向复制配置操作:

gc2:授权

SQL>grant CONNECT, RESOURCE to ogg;

SQL>grant CREATE SESSION, ALTER SESSION to ogg;

SQL>grant SELECT ANY DICTIONARY, SELECT ANY TABLE to ogg;

SQL>grant ALTER ANY TABLE to ogg;

SQL>grant FLASHBACK ANY TABLE to ogg;

SQL>grant EXECUTE on DBMS_FLASHBACK to ogg;

gc1:授权

SQL>grant CONNECT, RESOURCE to ogg;

SQL>grant CREATE SESSION, ALTER SESSION to ogg;

SQL>grant SELECT ANY DICTIONARY, SELECT ANY TABLE to ogg;

SQL>grant CREATE TABLE to ogg;

SQL>grant INSERT, UPDATE, DELETE on scott.tcustmer to ogg;--把须要同步表的DML操作授权给ogg

SQL>grant INSERT, UPDATE, DELETE on scott.tcustord to ogg;--把须要同步表的DML操作授权给ogg

gc2:开启补充日志

SQL>alter database add supplemental log data;

SQL>alter system switch logfile;

SQL>alter database force logging;

gc2:測试表加入到补充日志

GGSCI(gc2) 1> DBLOGIN USERID ogg, PASSWORD Ogg

Successfully logged into database.

GGSCI(gc2) 2> ADD TRANDATA scott.TCUSTMER

Logging of supplemental redo data enabled fortable SCOTT.TCUSTMER.

GGSCI(gc2) 3> ADD TRANDATA scott.TCUSTORD

Logging of supplemental redo data enabled fortable SCOTT.TCUSTORD.

gc2:配置Extract进程

GGSCI(gc2) 4> EDIT PARAMS EORA_1

-- Change Capture parameter file to capture

-- TCUSTMER and TCUSTORD changes

EXTRACT EORA_1

SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)

USERID ogg, PASSWORD Ogg

TRANLOGOPTIONS EXCLUDEUSER ogg

EXTTRAIL ./dirdat/aa

TABLE scott.TCUSTMER;

TABLE scott.TCUSTORD;

~

~

"dirprm/eora_1.prm" [New] 9L, 257Cwritten

GGSCI(gc2) 5> ADD EXTRACT EORA_1, TRANLOG, BEGIN NOW

EXTRACT added.

GGSCI(gc2) 6> ADD EXTTRAIL ./dirdat/aa, EXTRACT EORA_1, MEGABYTES 5

EXTTRAIL added.

GGSCI(gc2) 7> START EXTRACT EORA_1

Sending START request to MANAGER ...

EXTRACT EORA_1 starting

GGSCI(gc2) 8> INFO EXTRACT EORA_1

EXTRACT   EORA_1    Last Started 2014-06-1811:28   Status RUNNING

Checkpoint Lag       00:00:19 (updated 00:00:08 ago)

Log Read Checkpoint  Oracle Redo Logs

2014-06-18 11:27:42  Seqno 6, RBA 35344

gc2:配置Pump进程

GGSCI(gc2) 9> EDIT PARAMS PORA_1

加入下面内容:

-- Data Pump parameter file to read thelocal

-- trail of TCUSTMER and TCUSTORDchanges

--

EXTRACT PORA_1

SETENV(NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)

PASSTHRU

RMTHOST gc1, MGRPORT 7809

RMTTRAIL ./dirdat/pa

TABLE scott.TCUSTMER;

TABLE scott.TCUSTORD;

~

~

~

"dirprm/pora_1.prm" [New] 10L, 250Cwritten

GGSCI(gc2) 10> ADD EXTRACT PORA_1, EXTTRAILSOURCE ./dirdat/aa

EXTRACT added.

GGSCI(gc2) 11> ADD RMTTRAIL ./dirdat/pa, EXTRACT PORA_1, MEGABYTES 5

RMTTRAIL added.

GGSCI(gc2) 12> START EXTRACT PORA_1

Sending START request to MANAGER ...

EXTRACT PORA_1 starting

gc1:配置Replicat进程

GGSCI(gc1) 1> EDIT PARAMS ./GLOBALS

CHECKPOINTTABLE ogg.ggschkpt

~

~

"./GLOBALS" [New] 1L, 29C written

GGSCI(gc1) 2> quit

[oracle@gc1ogg]$ ll GLOBALS   --验证

-rw-rw-rw- 1 oracle oinstall 29 Jun 18 11:33GLOBALS

GGSCI(gc1) 1> DBLOGIN USERID ogg, PASSWORD Ogg

Successfully logged into database.

GGSCI(gc1) 2> ADD CHECKPOINTTABLE

No checkpoint table specified, using GLOBALSspecification (ogg.ggschkpt)...

Successfully created checkpoint tableOGG.GGSCHKPT.

gc1:配置Replicate进程

GGSCI(gc1) 3> EDIT PARAM RORA_1

--

-- Change Delivery parameter file to apply

-- TCUSTMER and TCUSTORD Changes

--

REPLICAT RORA_1

SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)

USERID ogg, PASSWORD Ogg

HANDLECOLLISIONS

ASSUMETARGETDEFS

DISCARDFILE ./dirrpt/RORA_aa.DSC, PURGE

MAP scott.tcustmer, TARGET scott.tcustmer;

MAP scott.tcustord, TARGET scott.tcustord;

~

~

"dirprm/rora_1.prm" [New] 12L, 327Cwritten

GGSCI(gc1) 4> ADD REPLICAT RORA_1, EXTTRAIL ./dirdat/pa

REPLICAT added.

GGSCI(gc1) 5> START REPLICAT RORA_1

Sending START request to MANAGER ...

REPLICAT RORA_1 starting

gc1:查看进程状态

GGSCI(gc1) 6> info all

Program    Status      Group       Lag           Time Since Chkpt

MANAGER    RUNNING

EXTRACT    RUNNING     EORA_1      00:00:00      00:00:08

EXTRACT    RUNNING     PORA_1      00:00:00      00:00:01

REPLICAT   RUNNING     RORA_1      00:00:00      00:00:06

gc2:查看进程状态

GGSCI(gc2) 13> info all

Program    Status      Group       Lag           Time Since Chkpt

MANAGER    RUNNING

EXTRACT    RUNNING     EORA_1      00:00:00      00:00:09

EXTRACT    RUNNING     PORA_1      00:00:00      00:00:06

REPLICAT   RUNNING     RORA_1      00:00:00      00:00:01

验证insert操作双向同步

gc1: gc1→gc2。DML操作:insert操作

SQL>insert into tcustmer VALUES('HYL','HUANG DBA.','HARBIN','CN');

1 row created.

SQL>commit;

Commit complete.

gc2:验证insert操作同步

SQL>select * from tcustmer;

CUST NAME                           CITY                 ST

---- -------------------------------------------------- --

HYL  HUANGDBA.                     HARBIN               CN

WILL BG SOFTWARE CO.                SEATTLE              WA

JANE ROCKY FLYER INC.               DENVER               CO

gc2:gc2→gc1,DML操作:insert操作

SQL>insert into tcustmer VALUES('WT','WANGDBA.','QINGDAO','CN');

1 row created.

SQL>commit;

Commit complete.

gc1:gc1→gc2。DML操作:update操作

SQL>select * from tcustmer;

CUST NAME                           CITY                 ST

---- -------------------------------------------------- --

HYL  HUANGDBA.                     HARBIN               CN

WILL BG SOFTWARE CO.                SEATTLE              WA

JANE ROCKY FLYER INC.               DENVER               CO

WT   WANGDBA.                      QINGDAO              CN

gc1:update操作

SQL>update tcustmer set city = 'BEIJING', state = 'CN' wherecust_code='HYL';

1 row updated.

SQL>commit;

Commit complete.

gc2:验证update操作同步

SQL>select * from tcustmer;

CUST NAME                           CITY                 ST

---- ------------------------------ ----------------------

HYL  HUANGDBA.                     BEIJING              CN

WILL BG SOFTWARE CO.                SEATTLE              WA

JANE ROCKY FLYER INC.               DENVER               CO

WT   WANGDBA.                      QINGDAO              CN

gc2:gc2→gc1,DML操作:update操作

SQL>update tcustmer set city = 'BEIJING', state = 'CN' wherecust_code='WT';

1 row updated.

SQL>commit;

Commit complete.

gc1:验证update操作同步

SQL>select * from tcustmer;

CUST NAME                           CITY                 ST

---- -------------------------------------------------- --

HYL  HUANGDBA.                     BEIJING              CN

WILL BG SOFTWARE CO.                SEATTLE              WA

JANE ROCKY FLYER INC.               DENVER               CO

WT   WANGDBA.                      BEIJING              CN

gc1:gc1→gc2,DML操作:delete操作

SQL>delete from tcustmer where CUST_CODE='WT';

1 row deleted.

SQL>commit;

Commit complete.

gc2:验证delete操作同步

SQL>select * from tcustmer;

CUST NAME                           CITY                 ST

---- -------------------------------------------------- --

HYL  HUANGDBA.                     BEIJING              CN

WILL BG SOFTWARE CO.                SEATTLE              WA

JANE ROCKY FLYER INC.               DENVER               CO

gc2:gc2→gc1。DML操作:delete操作

SQL>delete from tcustmer where CUST_CODE='HYL';

1 row deleted.

SQL>commit;

Commit complete.

gc1:验证delete操作同步

SQL>select * from TCUSTMER;

CUST NAME                           CITY                 ST

---- -------------------------------------------------- --

WILL BG SOFTWARE CO.                SEATTLE              WA

JANE ROCKY FLYER INC.               DENVER               CO

--至此,GoldenGate双向同步复制完毕

声明:

         原创作品,出自 “深蓝的blog” 博客,同意转载。转载时请务必注明出处(http://blog.csdn.net/huangyanlong)。

关于涉及版权事宜,作者有权追究法律责任。

GoldenGate配置(二)之双向复制配置的更多相关文章

  1. Linux(Ubuntu 16) 下Java开发环境的配置(二)------Tomcat的配置及常见问题

    前言 相比于java JDK的配置,Tomcat的配置简单的多,简直就相当于直接运行了,本文以Tomcat8.0为例进行配置   1.Tomcat的下载 地址:https://tomcat.apach ...

  2. MYSQL + MHA +keepalive + VIP安装配置(二)--MHA的配置

    一.总概 1.MHA介绍 MHA(Master High Availability)是自动的master故障转移和Slave提升的软件包.它是基于标准的MySQL复制(异步/半同步).      MH ...

  3. Goldengate双向复制配置

    一.Goldengate双向复制配置 1.1.在进行如下配置之前,先在源数据库source system(原来的目标数据库)端 添加辅助的redolog配置: SQL>alter databas ...

  4. CDN网络(二)之配置和优化CDN核心缓存软件--squid

    前言 squid是众多CDN厂商使用的核心缓存软件,都在已有的基础上进行二次开发.在部署squid的时候,建议遵循下面的规范. 1. 使用大内存服务器 对于热点文件,我们让squid用内存缓存,这样大 ...

  5. EMW 性能优化二之---并发配置

    EMW 性能优化二之---并发配置 在前一个日志中写到交货的异步更新,对于RFUI RF的前台操作会提升效率,异步更新不用等待更新状态的返回,启用更新队列的方式执行(SM13). 下面再补全性能相关的 ...

  6. Sql Server来龙去脉系列之二 框架和配置

    本节主要讲维持数据的元数据,以及数据库框架结构.内存管理.系统配置等.这些技术点在我们使用数据库时很少接触到,但如果要深入学习Sql Server这一章节也是不得不看.本人能力有限不能把所有核心的知识 ...

  7. Maven 工程下 Spring MVC 站点配置 (二) Mybatis数据操作

    详细的Spring MVC框架搭配在这个连接中: Maven 工程下 Spring MVC 站点配置 (一) Maven 工程下 Spring MVC 站点配置 (二) Mybatis数据操作 这篇主 ...

  8. SpringMVC常用配置(二),最简洁的配置实现文件上传

    Spring.SpringMVC持续介绍中,基础配置前面已经介绍了很多,如果小伙伴们还不熟悉可以参考这几篇文章: 1.Spring基础配置 2.Spring常用配置 3.Spring常用配置(二) 4 ...

  9. 前端工程化(二)---webpack配置

    导航 前端工程化(一)---工程基础目录搭建 前端工程化(二)---webpack配置 前端工程化(三)---Vue的开发模式 前端工程化(四)---helloWord 继续上一遍的配置,本节主要记录 ...

随机推荐

  1. 写一个兼容性比较好的拖拽DEMO

    写一个兼容性比较好的拖拽DEMO 查看Demo 思路 div盒子 鼠标按下事件onmousedown 鼠标移动事件onmousemove,获得鼠标的坐标,将div移动至鼠标的当前坐标 鼠标抬起事件om ...

  2. python2.5_1.5_通过指定的端口和协议找到服务名

    代码如下: # -*- coding: utf-8 -*- import socket def find_service_name(): protocolname = 'tcp' for port i ...

  3. html基本框架

  4. 基于visual Studio2013解决C语言竞赛题之0306分数转换

      题目 解决代码及点评 根据题目要去,我们可以通过if实现该功能,伪代码如下: if(a > 90) print 'A' else if(a>80) print 'b' else ...

  5. BZOJ 1029: [JSOI2007]建筑抢修

    1029: [JSOI2007]建筑抢修 Description 小刚在玩JSOI提供的一个称之为“建筑抢修”的电脑游戏:经过了一场激烈的战斗,T部落消灭了所有z部落的入侵者.但是T部落的基地里已经有 ...

  6. iOS-容易造成循环引用的三种场景

    ARC已经出来很久了,自动释放内存的确很方便,但是并非绝对安全绝对不会产生内存泄露.导致iOS对象无法按预期释放的一个无形杀手是——循环引 用.循环引用可以简单理解为A引用了B,而B又引用了A,双方都 ...

  7. Codeforces Round #198 (Div. 2) B. Maximal Area Quadrilateral

    B. Maximal Area Quadrilateral time limit per test 1 second memory limit per test 256 megabytes input ...

  8. BZOJ 3240([Noi2013]矩阵游戏-费马小定理【矩阵推论】-%*s-快速读入)

    3240: [Noi2013]矩阵游戏 Time Limit: 10 Sec   Memory Limit: 256 MB Submit: 123   Solved: 73 [ Submit][ St ...

  9. ios inHouse 公布应用

    一.明白几个概念 1.企业版IDP: 即iOS Development Enterprise Program.注意是$299/Year那种.并非$99/Year的那种 2.In House:是指企业内 ...

  10. Pyton——int内部功能介绍

    int内部功能详解: class int(object): """ int(x=0) -> integer int(x, base=10) -> intege ...