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

  1. is lawsuit canada

    4a57 is en espana sin receta

    回复
  2. we use it how does is work

    3570 is les effets secondaires

    回复
  3. is acquisto farmacia itali

    3570 marque el descuento de is

    回复
  4. is de

    0fe2 is 8 st

    回复
  5. be is us at

    10c8 u be can boots is

    回复
  6. preco ato is

    10c8 at is is safe

    回复
  7. i use it is from mexico

    9509 is sales worldwide

    回复
  8. is par cheque

    e7cf retail price of is 50mg

    回复
  9. is aus kanada bestellen

    9136 is with discount

    回复

发表评论

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