LSX-blog

Feed Rss

【原创】GoldenGate 安装配置

02.22.2013, Oracle, by .

一、先决条件

尽量保证所有表都具有主键或者唯一索引,当然也可部分无伤大雅的表也可以没有,

但要保证表中可以确定出来一条唯一的记录。

二、数据库准备阶段

1、环境变量(源和目标都要)

####################################

export PATH

ORACLE_SID=test

ORACLE_BASE=/opt/app/oracle

ORACLE_HOME=$ORACLE_BASE/oracle/product/10.2.0/db_1

PATH=$PATH:$ORACLE_HOME/bin

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:$LD_LIBRARY_PATH

export ORACLE_SID ORACLE_BASE ORACLE_HOME PATH LD_LIBRARY_PATH

export NLS_LANG=”Simplified Chinese_china”.ZHS16GBK

stty erase ^H

alias sqlplus=’rlwrap sqlplus’

alias rman=’rlwrap rman’

alias ggsci=’rlwrap /opt/app/goldenGate/ggsci’

#####################################

2、需排除的表

#####################################

ST_USER_NAME

TEST

TMP_PROJECT_ID

TMP_TICKET_ID

3、无主键的表

####################################

M_MANAGER_ROLE

M_ROLE_AUTHORITY

####################################

4、需要同步的Schemas

####################################

TC258

PAYCENTRE

####################################

三、先决条件

1、确定归档模式已打开,如果没有打开按以下步骤进行(源和目标都要一样)

#########################################

mkdir /opt/app/oracle/oraArchive

sqlplus /nolog

conn /as sysdba

startup mount;

alter database archivelog;

alter system set log_archive_dest_1=’location=/opt/app/oracle/oraArchive’;

alter system set log_archive_dest_state_1=enable;

alter database open;

archive log list;

##########################################

2、开启最小日志功能

###########################################

##最小附加日志模式

##强制日志模式

##强制重做日志记录主键值

alter database add supplemental log data;

Alter database force logging;

alter database add supplemental log data (primary key,unique,foreign key) columns;

##以下是查询状态

select supplemental_log_data_min from v$database;

select force_logging from v$database;

select supplemental_log_data_min,supplemental_log_data_pk,

supplemental_log_data_ui from v$database;

############################################

四、安装GoldenGate

1、 下载GoldenGate

在以下地址下载对应版本

http://www.oracle.com/technetwork/middleware/goldengate/downloads/index.html

2、 创建GoldenGate安装目录

mkdir /opt/app/goldenGate/

3、 直接解压到压缩文件到/opt/app/goldenGate目录即安装完成

4、 配置GoldenGate(源与目标一样)

[oracle@oracle01 goldenGate]$ ./ggsci

GGSCI> CREATE SUBDIRS

GGSCI>edit param mgr

#######################

port 7801

dynamicportlist 7802-7820

AUTOSTART ER * ##在目标机器上面删除这一行

AUTORESTART ER *, RETRIES 4, WAITMINUTES 4

STARTUPVALIDATIONDELAY 5

PURGEOLDEXTRACTS /opt/app/goldenGate/dirdat/*, USECHECKPOINTS, MINKEEPHOURS 2

###########################

保存

GGSCI>exit

五、配置源GoldenGate

1、 配置提取进程(按scheams划分)

############################################

GGSCI>add extract tc258,tranlog,begin now

GGSCI>add extract pay,tranlog,begin now

############################################

GGSCI>edit param tc258

########################

extract tc258

userid system@test,password oracle

exttrail /opt/app/goldenGate/dirdat/la

dynamicresolution

gettruncates

tableexclude tc258.ST_USER_NAME;

tableexclude tc258.TEST;

tableexclude tc258.TMP_PROJECT_ID;

tableexclude tc258.TMP_TICKET_ID;

table tc258.*;

#########################

GGSCI>edit param pay

########################

extract pay

userid system@test,password oracle

exttrail /opt/app/goldenGate/dirdat/lb

dynamicresolution

gettruncates

table paycentre.*;

#########################

GGSCI>ADD EXTTRAIL /opt/app/goldenGate/dirdat/la, EXTRACT tc258

GGSCI>ADD EXTTRAIL /opt/app/goldenGate/dirdat/lb, EXTRACT pay

2、添加DataPump 进程

GGSCI>add extract P-tc258,exttrailsource /opt/app/goldenGate/dirdat/la,begin now

GGSCI>add extract P-pay,exttrailsource /opt/app/goldenGate/dirdat/lb,begin now

GGSCI>edit param p-tc258

###############################

extract p-tc258

userid system,password oracle

rmthost 192.168.242.137,mgrport 7801

rmttrail /opt/app/goldenGate/dirdat/ra

PASSTHRU

gettruncates

table tc258.*;

################################

GGSCI>edit param p-pay

###############################

extract p-pay

userid system,password oracle

rmthost 192.168.242.137,mgrport 7801

rmttrail /opt/app/goldenGate/dirdat/rb

PASSTHRU

gettruncates

table paycentre.*;

################################

2、 添加远端队列

GGSCI>add rmttrail /opt/app/goldenGate/dirdat/ra extract p-tc258

GGSCI>add rmttrail /opt/app/goldenGate/dirdat/rb extract p-pay

六、配置源expdp 数据泵(源与目标都要一样)

1、 创建目录

mkdir /opt/app/oracle/oraExpdp

2、 执行SQL

CREATE OR REPLACE DIRECTORY

EXPDP AS

‘/opt/app/oracle/oraExpdp’;

GRANT READ, WRITE ON DIRECTORY EXPDP TO SYSTEM WITH GRANT OPTION;

七、同步源数据库到目标数据库

1、 启动GoldenGate

GGSCI (oracle01) 2> start mgr

clip_image002

2、 查询SCN号

clip_image004

3、 备份Scheams数据

expdp system/oracle DIRECTORY=expdp DUMPFILE=export.dmp SCHEMAS=tc258,paycentre FLASHBACK_SCN=688187 LOGFILE=export.log

4、 上传到目标机器/opt/app/oracle/oraExpdp目录

scp /opt/app/oracle/oraExpdp/export.dmp oracle@192.168.242.137:/opt/app/oracle/oraExpdp/

5、 在目标创建相关的表空间

1、 TC258

CREATE TABLESPACE tc258_data LOGGING DATAFILE ‘/opt/app/oracle/oradata/test/tc258_data01.dbf’ SIZE 100M AUTOEXTEND ON NEXT 50M MAXSIZE UNLIMITED;

CREATE TEMPORARY TABLESPACE tc258_temp TEMPFILE ‘/opt/app/oracle/oradata/test/tc258_temp01.dbf’ SIZE 100M AUTOEXTEND ON NEXT 50M MAXSIZE UNLIMITED;

2、 PAYCENTRE Scheam

CREATE TABLESPACE PAYCENTRE_DATA DATAFILE ‘/opt/app/oracle/oradata/test/paycentre_data01.dbf’ SIZE 100M AUTOEXTEND ON NEXT 50M MAXSIZE UNLIMITED;

CREATE TEMPORARY TABLESPACE PAYCENTRE_TEMP TEMPFILE ‘/opt/app/oracle/oradata/test/paycentre_temp01.dbf’ SIZE 100M AUTOEXTEND ON NEXT 50M MAXSIZE UNLIMITED;

3、 执行导入操作

impdp system/oracle DIRECTORY=expdp DUMPFILE=export.dmp SCHEMAS=tc258,paycentre LOGFILE=export.log

八、配置目标服务器

1、 配置检查点

GGSCI (BakOracle) 1> dblogin,userid system password oracle

GGSCI (BakOracle) 2> add checkpointtable tc258.checkpoint

GGSCI (BakOracle) 3> add checkpointtable paycentre.checkpoint

GGSCI (BakOracle) 4> edit params ./GLOBALS

############ file

checkpointtable tc258.checkpoint

checkpointtable paycentre.checkpoint

############ end

2、 创建日志目录

mkdir /opt/app/goldenGate/dirlog/

3、 配置复制进程

add replicat tc258 exttrail /opt/app/goldenGate/dirdat/ra,begin now,checkpointtable tc258.checkpoint

add replicat pay exttrail /opt/app/goldenGate/dirdat/rb,begin now,checkpointtable paycentre.checkpoint

4、 编辑复制进程配置文件

GGSCI (BakOracle) 8> edit param tc258

########## file

replicat tc258

userid system@test,password oracle

assumetargetdefs

discardfile /opt/app/goldenGate/dirlog/repl-tc258.log,append,megabytes 100

gettruncates

map tc258.*, target tc258.*;

########## end

GGSCI (BakOracle) 9> edit param pay

######### file

replicat pay

userid system@test,password oracle

assumetargetdefs

discardfile /opt/app/goldenGate/dirlog/repl-pay.log,append,megabytes 100

gettruncates

map paycentre.*, target paycentre.*;

######### end

九、启动GoldenGate

1、 在源服务器上面启动

GGSCI (oracle01) 3> start mgr

clip_image006

2、 在目标服务器上面启动

编辑mgr主进程文件

Edit param mgr

注释里面的AUTOSTART ER *

样式如下

—AUTOSTART ER *

clip_image008

GGSCI (BakOracle) 15> start mgr

clip_image010

分别启动两个进程

GGSCI (BakOracle) 1> start tc258 aftercsn 688187

GGSCI (BakOracle) 3> start pay aftercsn 688187

clip_image012

把上一步有注释去除即可

配置完成

【原创】GoldenGate 安装配置 有 37 条回应

  1. Hello everyone, it’s my first go to see at this website, and post is truly fruitful for me, keep up posting such articles or reviews.| а

    回复
  2. What’s up colleagues, its fantastic article regarding tutoringand fully explained, keep it up all the
    time.

    回复
  3. I’m amazed, I have to admit. Rarely do I encounter a blog that’s both educative and entertaining, and without a doubt, you’ve hit the nail on the head.
    The problem is something too few men and women are speaking intelligently about.

    I’m very happy I found this in my hunt for something concerning this.

    回复
  4. Aw, this was an exceptionally good post. Finding the time and actual effort
    to produce a great article… but what can I say… I put things off a lot and never
    manage to get nearly anything done.

    回复
  5. Does your blog have a contact page? I’m having problems locating it
    but, I’d like to send you an e-mail. I’ve got some ideas for
    your blog you might be interested in hearing. Either
    way, great site and I look forward to seeing it grow over time.

    回复
  6. Hey excellent blog! Does running a blog like this require a large amount of work?
    I have virtually no expertise in computer programming however I was
    hoping to start my own blog in the near future. Anyways, should you have any ideas or tips for new blog owners please share.
    I know this is off subject but I simply wanted to ask.

    Thanks a lot!

    回复
  7. I am curious to find out what blog system you happen to be using?
    I’m having some small security problems with my latest website and I would like to find something more safeguarded.

    Do you have any recommendations?

    回复
  8. After going over a number of the articles on your blog, I
    seriously like your way of writing a blog.
    I saved as a favorite it to my bookmark webpage list and will
    be checking back in the near future. Please check out my website as well
    and tell me your opinion.

    回复
  9. I know this site presents quality depending posts and other stuff, is there any other web site which provides these
    stuff in quality?

    回复
  10. It’s awesome for me to have a web page, which is beneficial designed for my experience.
    thanks admin

    回复
  11. Hey there, You’ve done a great job. I will definitely digg it and personally suggest to my friends.
    I am confident they’ll be benefited from this web site.

    回复
  12. It’s going to be ending of mine day, but before ending I am reading this enormous piece
    of writing to increase my experience.

    回复
  13. I’m not sure exactly why but this website is loading extremely slow
    for me. Is anyone else having this problem or is it a issue on my end?
    I’ll check back later and see if the problem still exists.

    回复
  14. Sweet blog! I found it while browsing on Yahoo
    News. Do you have any suggestions on how to get listed in Yahoo News?

    I’ve been trying for a while but I never seem to get there!

    Many thanks

    回复
  15. Hi there, just became alert to your blog through Google, and
    found that it is truly informative. I’m gonna watch out for brussels.
    I will be grateful if you continue this in future.
    Lots of people will be benefited from your writing.

    Cheers!

    回复
  16. When someone writes an post he/she maintains the thought of a user in his/her brain that how a user can know
    it. Thus that’s why this article is outstdanding.
    Thanks!

    回复
  17. I know this web site offers quality based content and additional information,
    is there any other web site which presents such data in quality?

    回复
  18. Having read this I thought it was extremely enlightening.
    I appreciate you finding the time and effort to put this short article together.
    I once again find myself spending a lot of time both reading and
    leaving comments. But so what, it was still worth it!

    回复
  19. What’s up, constantly i used to check weblog posts here early in the dawn, for the reason that
    i enjoy to gain knowledge of more and more.

    回复
  20. Wonderful article! This is the kind of info that are supposed to be shared around the internet.
    Disgrace on Google for no longer positioning this put up upper!
    Come on over and talk over with my site . Thanks =)

    回复
  21. Everything is very open with a clear clarification of the issues.
    It was definitely informative. Your site is very helpful. Thanks for
    sharing!

    回复
  22. Have you ever thought about including a little bit more than just your articles?
    I mean, what you say is important and all. But think of
    if you added some great visuals or video clips to give your posts more, “pop”!
    Your content is excellent but with pics and video clips, this site could undeniably be one of the most beneficial in its niche.
    Amazing blog!

    回复
  23. Hey There. I found your weblog the usage of msn. That is a
    very smartly written article. I will make sure to bookmark it and return to read more of your useful
    information. Thank you for the post. I will definitely comeback.

    回复
  24. Thank you for the good writeup. It in fact was a leisure account
    it. Look advanced to more delivered agreeable from you! However, how could we keep up a correspondence?

    回复
  25. I think that everything said was actually very reasonable.
    However, think about this, what if you added a little content?

    I mean, I don’t wish to tell you how to run your website, however
    suppose you added a post title that grabbed folk’s attention? I mean 【原创】GoldenGate 安装配置
    – LSX-blog is kinda plain. You might glance at Yahoo’s home page
    and note how they write news titles to grab people interested.

    You might add a related video or a picture or two to get readers excited about everything’ve got to say.

    In my opinion, it would make your posts a
    little livelier.

    回复
  26. Why viewers still make use of to read news papers when in this technological globe everything is accessible on web?

    回复
  27. Its like you learn my thoughts! You appear to understand so much approximately this, such
    as you wrote the e book in it or something. I feel that you simply can do with a few p.c.
    to drive the message home a little bit, but other than that,
    that is magnificent blog. A fantastic read. I will
    certainly be back.

    回复
  28. Thank you for the good writeup. It in fact was a amusement account it.
    Look advanced to far added agreeable from
    you! By the way, how could we communicate?

    回复
  29. is lawsuit canada

    4a57 is en espana sin receta

    回复
  30. we use it how does is work

    3570 is les effets secondaires

    回复
  31. is acquisto farmacia itali

    3570 marque el descuento de is

    回复
  32. is de

    0fe2 is 8 st

    回复
  33. be is us at

    10c8 u be can boots is

    回复
  34. preco ato is

    10c8 at is is safe

    回复
  35. i use it is from mexico

    9509 is sales worldwide

    回复
  36. is par cheque

    e7cf retail price of is 50mg

    回复
  37. is aus kanada bestellen

    9136 is with discount

    回复

发表评论

电子邮件地址不会被公开。 必填项已用*标注