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 安装配置 有 248 条回应

  1. I’m gone to say to my little brother, that he should also visit this webpage on regular basis to take updated from latest news.| а

    回复
  2. Hi, its fastidious paragraph concerning media print, we all be aware of media is a enormous source of facts.| а

    回复
  3. Painter And Decorator Gloucester
    38 Bruton Way
    Gloucester GL1 1DA, United Kingdom
    01452 223268

    回复
  4. Whoa! This blog looks exactly like my old one! It’s on a totally different topic but it has pretty much the same layout and design. Great choice of colors!| а

    回复
  5. I really like what you guys tend to be up too. This kind of clever work and exposure! Keep up the wonderful works guys I’ve added you guys to my personal blogroll.| а

    回复
  6. Do you mind if I quote a couple of your posts as long as I provide credit and sources back to your site? My website is in the very same area of interest as yours and my visitors would definitely benefit from some of the information you provide here. Please let me know if this alright with you. Thanks a lot!| а

    回复
  7. I am curious to find out what blog platform you’re using? I’m experiencing some small security problems with my latest website and I would like to find something more safeguarded. Do you have any solutions?| а

    回复
  8. Thank you for sharing your info. I truly appreciate your efforts and I will be waiting for your next post thanks once again.| а

    回复
  9. Excellent post. I was checking continuously this blog and I’m impressed! Very useful information specially the last part 🙂 I care for such info a lot. I was looking for this certain info for a very long time. Thank you and best of luck.| а

    回复
  10. No matter if some one searches for his necessary thing, thus he/she needs to be available that in detail, so that thing is maintained over here.| а

    回复
  11. Your method of telling everything in this paragraph is genuinely fastidious, all be capable of effortlessly know it, Thanks a lot.| а

    回复
  12. It’s a pity you don’t have a donate button! I’d most certainly donate to this outstanding blog! I guess for now i’ll settle for book-marking and adding your RSS feed to my Google account. I look forward to brand new updates and will talk about this website with my Facebook group. Talk soon!| а

    回复
  13. Really when someone doesn’t know after that its up to other viewers that they will help, so here it occurs.| а

    回复
  14. Wow that was odd. I just wrote an very long comment but after I clicked submit my comment didn’t appear. Grrrr… well I’m not writing all that over again. Anyway, just wanted to say excellent blog!| а

    回复
  15. Yes! Finally someone writes about %keyword1%.| а

    回复
  16. Hi there friends, its impressive paragraph concerning educationand completely explained, keep it up all the time.| а

    回复
  17. I do not even know how I ended up here, but I thought this post was great. I do not know who you are but definitely you are going to a famous blogger if you aren’t already 😉 Cheers!| а

    回复
  18. Thanks for sharing your thoughts. I truly appreciate your efforts and I will be waiting for your further write ups thanks once again.| а

    回复
  19. Hello, this weekend is good designed for me, because this time i am reading this fantastic informative paragraph here at my home.| а

    回复
  20. I really like it when people come together and share opinions. Great site, stick with it!| а

    回复
  21. This website was… how do you say it? Relevant!! Finally I have found something which helped me. Thanks!| а

    回复
  22. Hello are using WordPress for your site platform? I’m new to the blog world but I’m trying to get started and create my own. Do you need any coding knowledge to make your own blog? Any help would be greatly appreciated!| а

    回复
  23. I every time used to read paragraph in news papers but now as I am a user of net thus from now I am using net for articles or reviews, thanks to web.| а

    回复
  24. Hurrah! At last I got a blog from where I be capable of actually get helpful facts concerning my study and knowledge.| а

    回复
  25. This is a topic that is close to my heart… Thank you! Where are your contact details though?| а

    回复
  26. This piece of writing will help the internet users for creating new web site or even a weblog from start to end.| а

    回复
  27. Hello! I’ve been following your blog for a while now and finally got the bravery to go ahead and give you a shout out from Humble Tx! Just wanted to mention keep up the good work!| а

    回复
  28. buy viagra online no prescription buy viagra new york order viagra today buy viagra online canada
    purchase viagra online

    回复
  29. generic for cialis cialis cheapest price cheap cialis online canadian pharmacy

    回复
  30. I think the admin of this web page is in fact working hard in support of his website, for the reason that here every stuff is quality based information.| а

    回复
  31. Hi there I am so grateful I found your blog page, I really found you by error, while I was researching on Bing for something else, Anyways I am here now and would just like to say many thanks for a incredible post and a all round enjoyable blog (I also love the theme/design), I don’t have time to read it all at the moment but I have book-marked it and also added in your RSS feeds, so when I have time I will be back to read much more, Please do keep up the fantastic work.| а

    回复
  32. Great article, totally what I needed.| а

    回复
  33. I’m very pleased to uncover this website. I wanted to thank you for your time for this fantastic read!! I definitely liked every little bit of it and i also have you book marked to check out new stuff in your web site.| а

    回复
  34. I’ve learn a few good stuff here. Definitely value bookmarking for revisiting. I surprise how much attempt you put to make the sort of magnificent informative web site.| а

    回复
  35. Hi there! I know this is sort of off-topic however I had to ask. Does running a well-established blog such as yours take a massive amount work? I am completely new to running a blog however I do write in my journal daily. I’d like to start a blog so I can share my experience and feelings online. Please let me know if you have any kind of suggestions or tips for brand new aspiring blog owners. Thankyou!| а

    回复
  36. Good day! I know this is somewhat off topic but I was wondering which blog platform are you using for this website? I’m getting sick and tired of WordPress because I’ve had issues with hackers and I’m looking at options for another platform. I would be fantastic if you could point me in the direction of a good platform.| а

    回复
  37. I relish, lead to I discovered just what I was looking for. You’ve ended my 4 day lengthy hunt! God Bless you man. Have a nice day. Bye| а

    回复
  38. I really like what you guys are usually up too. This type of clever work and coverage! Keep up the good works guys I’ve added you guys to my personal blogroll.| а

    回复
  39. It’s very effortless to find out any matter on net as compared to books, as I found this article at this site.| а

    回复
  40. I blog frequently and I truly appreciate your content. Your article has really peaked my interest. I am going to take a note of your blog and keep checking for new information about once per week. I subscribed to your Feed as well.| а

    回复
  41. I’m gone to inform my little brother, that he should also go to see this website on regular basis to take updated from most recent gossip.| а

    回复
  42. My brother recommended I might like this website. He was totally right. This post truly made my day. You can not imagine just how much time I had spent for this information! Thanks!| а

    回复
  43. This post is priceless. How can I find out more?| а

    回复
  44. Wow, incredible blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your site is excellent, as well as the content!| а

    回复
  45. Aw, this was an extremely nice post. Spending some time and actual effort to make a great article… but what can I say… I hesitate a lot and never manage to get nearly anything done.| а

    回复

发表评论

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