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

  1. I’m amazed, I have to admit. Seldom do I encounter a blog that’s both equally educative and entertaining, and without a doubt, you have hit the nail on the head. The problem is an issue that too few folks are speaking intelligently about. I’m very happy that I stumbled across this during my search for something relating to this.| а

    回复
  2. Hello my family member! I want to say that this article is amazing, great written and include approximately all significant infos. I’d like to see extra posts like this .| а

    回复
  3. Having read this I believed it was really informative. I appreciate you taking the time and effort to put this informative article together. I once again find myself spending a significant amount of time both reading and leaving comments. But so what, it was still worthwhile!| а

    回复
  4. I am regular visitor, how are you everybody? This article posted at this site is in fact pleasant.| а

    回复
  5. It’s the best time to make some plans for the future and it’s time to be happy. I have read this post and if I could I desire to suggest you few interesting things or tips. Maybe you could write next articles referring to this article. I desire to read even more things about it!| а

    回复
  6. I constantly emailed this weblog post page to all my associates, because if like to read it after that my links will too.| а

    回复
  7. It’s genuinely very complex in this busy life to listen news on Television, so I just use web for that purpose, and take the newest news.| а

    回复
  8. This is a topic that is near to my heart… Thank you! Exactly where are your contact details though?| а

    回复
  9. I am not sure where you’re getting your info, but great topic.
    I needs to spend some time learning more or understanding more.
    Thanks for excellent info I was looking for this information for my
    mission.

    回复
  10. Thanks for one’s marvelous posting! I genuinely enjoyed reading it, you could be a
    great author. I will always bookmark your blog and
    will eventually come back sometime soon. I want to encourage continue your
    great writing, have a nice morning!

    回复
  11. [url=https://diflucanrx.com/]diflucan buy without prescription[/url]

    回复
  12. all the time i used to read smaller articles which as well
    clear their motive, and that is also happening with this article which I
    am reading here.

    回复
  13. Having read this I thought it was rather informative.
    I appreciate you spending some time and effort to put this information together.
    I once again find myself spending a significant amount of time both reading and commenting.
    But so what, it was still worth it!

    回复
  14. Thanks for the marvelous posting! I genuinely enjoyed reading it, you could be a great
    author.I will remember to bookmark your blog
    and will eventually come back sometime soon. I want to encourage you to ultimately continue your great job, have
    a nice evening!

    回复
  15. You should be a part of a contest for one of the finest sites on the net. I’m going to highly recommend this website!| а

    回复
  16. Heya i’m for the first time here. I came across this board and I find It truly useful & it helped me out a lot. I hope to give something back and aid others like you aided me.| а

    回复
  17. Hi! Do you use Twitter? I’d like to follow you if that would be ok. I’m undoubtedly enjoying your blog and look forward to new posts.| а

    回复
  18. This paragraph will assist the internet users for setting up new webpage or even a blog from start to end.| а

    回复
  19. Hello there I am so thrilled I found your web site, I really found you by error, while I was browsing on Yahoo for something else, Anyhow I am here now and would just like to say cheers for a fantastic post and a all round enjoyable blog (I also love the theme/design), I don’t have time to read through it all at the minute but I have saved it and also added your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the superb work.| а

    回复
  20. Please let me know if you’re looking for a writer for your blog. You have some really great articles and I think I would be a good asset. If you ever want to take some of the load off, I’d love to write some content for your blog in exchange for a link back to mine. Please blast me an e-mail if interested. Kudos!| а

    回复
  21. Very good blog! Do you have any helpful hints for aspiring writers? I’m planning to start my own blog soon but I’m a little lost on everything. Would you advise starting with a free platform like WordPress or go for a paid option? There are so many choices out there that I’m completely overwhelmed .. Any tips? Cheers!| а

    回复
  22. I was recommended this web site by means of my cousin. I am no
    longer certain whether this publish is written by means of him as no one else recognize such
    designated about my trouble. You are incredible!
    Thank you!

    回复
  23. Do you have a spam issue on this blog; I also am a blogger, and I was wanting to know your situation; many of us have developed some nice practices and we are looking to exchange methods with other folks, be sure to shoot me an email if interested.| а

    回复
  24. Hi there! This is kind of off topic but I need some help from an established blog. Is it tough to set up your own blog? I’m not very techincal but I can figure things out pretty quick. I’m thinking about setting up my own but I’m not sure where to begin. Do you have any points or suggestions? Many thanks| а

    回复
  25. Magnificent goods from you, man. I have consider your stuff previous to and you’re simply extremely great. I actually like what you have received right here, really like what you’re stating and the way in which you say it. You’re making it enjoyable and you continue to care for to keep it smart. I cant wait to read far more from you. That is actually a tremendous website.| а

    回复
  26. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You definitely know what youre talking about, why waste your intelligence on just posting videos to your site when you could be giving us something informative to read?| а

    回复
  27. I blog often and I really appreciate your information. This article has truly peaked my interest. I will bookmark your blog and keep checking for new information about once per week. I subscribed to your RSS feed too.| а

    回复
  28. I seriously love your blog.. Great colors & theme. Did you build this site yourself? Please reply back as I’m looking to create my own website and would like to find out where you got this from or what the theme is named. Kudos!| а

    回复
  29. Hi there, I found your site by means of Google while searching for a comparable matter, your site came up, it seems to be good. I have bookmarked it in my google bookmarks. а

    回复
  30. Hey! This is kind of off topic but I need some help from an established blog. Is it tough to set up your own blog? I’m not very techincal but I can figure things out pretty quick. I’m thinking about setting up my own but I’m not sure where to begin. Do you have any tips or suggestions? Appreciate it| а

    回复
  31. I know this website offers quality depending posts and other data, is there any other web page which gives these data in quality?| а

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

    回复
  33. Wow, this post is nice, my younger sister is analyzing such things, so I am going to let know her.| а

    回复
  34. Hello there! Do you use Twitter? I’d like to follow you if that would be ok. I’m definitely enjoying your blog and look forward to new posts.| а

    回复
  35. Hi there would you mind stating which blog platform you’re using? I’m planning to start my own blog soon but I’m having a difficult time deciding between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design seems different then most blogs and I’m looking for something unique. P.S Apologies for getting off-topic but I had to ask!| а

    回复
  36. Very good article. I will be dealing with some of these issues as well..| а

    回复
  37. Hello to every , for the reason that I am actually keen of reading this weblog’s post to be updated daily. It carries pleasant information.| а

    回复
  38. Thanks for your personal marvelous posting! I genuinely enjoyed reading it, you’re a great author.I will ensure that I bookmark your blog and will come back very soon. I want to encourage yourself to continue your great job, have a nice morning!| а

    回复
  39. I read this piece of writing completely regarding the difference of most up-to-date and previous technologies, it’s remarkable article.| а

    回复

发表评论

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