GoldenGate配置(二)之双向复制配置「建议收藏」

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

大家好,又见面了,我是全栈君。

 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)。

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

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/116145.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • Mysql Connector C++ 在VS2008下编译[通俗易懂]

    Mysql Connector C++ 在VS2008下编译[通俗易懂]1、安装Mysql下载http://dev.mysql.com/downloads/windows/installer/,安装即可2、安装完成之后找到安装目录下有ConnectorC++1.1.3目录,目录下有include和lib文件夹在vs2008中将include路径包含进来:再把lib路径包含进来:再将mysqlcppconn.lib库以及mysql

  • DOS攻击工具(dos攻击教程)

    DOS攻击工具(dos攻击教程)DoS(DenialOfService)攻击是指故意的攻击网络协议实现的缺陷或直接通过野蛮手段残忍地耗尽被攻击对象的资源,目的是让目标计算机或网络无法提供正常的服务或资源访问,使目标系统服务系统停止响应甚至崩溃然而随着网络上免费的可用DDoS工具增多,DoS攻击也日益增长,下面介绍几款Hacker常用的DoS攻击工具。特别提示:仅用于攻防演练及教学测试用途,禁止非法使用。1、卢瓦(LO…

  • Edge breaker记录

    Edge breaker记录和代码相关性非常强的是这篇文章,几乎就是伪代码了:http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.58.7918&rep=rep1&type=pdf一、Compression阶段命令参数为umbrellla_times4.offB第一个参数就是输入网格,目前支持OFF和OVTable两种文件格式,这里…

  • 在java中print和println_JAVA命令行参数

    在java中print和println_JAVA命令行参数Java中的PrintWriter类的println()方法用于中断流中的行。此方法不接受任何参数或返回任何值。用法:publicvoidprintln()参数:此方法不接受任何参数。返回:此方法不返回任何值。下面的方法说明了println()方法的用法方式:示例1://Javaprogramtodemonstrate//PrintWriterprintln()methodimp…

  • 3月份感觉比较漫长,可能因为经历得比较多吧

    3月份感觉比较漫长,可能因为经历得比较多吧

    2020年11月12日
  • dubbo负载均衡策略配置

    dubbo负载均衡策略配置前言在生产环境中,服务的集群部署是常有的事,从消费端来说,本身并不关注所需要的服务是由哪台机器提供,但是为了应用的健壮性和高可用性,从消费端来说,可以配置一定的负载均衡策略,确保消费端的应用能够及时获取到服务的响应数据dubbo负载均衡策略dubbo内置了四种负载均衡算法供开发中调用random随机算法,是Dubbo默认的负载均衡算法,多台机器上的服务随机选取一台的服务进行调用,如果各机器的性能相差不大的情况下,可以考虑使用这种策略。但这种策略可能存在服务堆积问题roundrobin轮询

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号