前言

Goldengate再rac 环境部署,和单机部署区别还是有点大,主要存在环境上.

环境

oracle10g ,sid=rac

准备工作

1.在rac节点,配置监听动态注册,确保goldengate用户能够连接实例。安装部分分为源端和目标端

节点一配置:

[oracle@rac1 admin]$ cat listener.ora
# listener.ora.rac1 Network Configuration File: /opt/oracle//db_1/network/admin/listener.ora.rac1
# Generated by Oracle configuration tools. LISTENER_RAC1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = )(IP = FIRST))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.141)(PORT = )(IP = FIRST))
)
) SID_LIST_LISTENER_RAC1 =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /opt/oracle//db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = +ASM)
(ORACLE_HOME = /opt/oracle//db_1)
(SID_NAME = +ASM1)
)
)
[oracle@rac1 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /opt/oracle/102/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools. RAC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = rac)
)
) LISTENERS_RAC =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))
) RAC2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = rac)
(INSTANCE_NAME = rac2)
)
) RAC1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = rac)
(INSTANCE_NAME = rac1)
)
) EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
) ASM =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.141)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = +ASM)
(SID_NAME = +ASM1)
)
)

节点二相同配置,记得修改对应参数

重启监听

[oracle@rac1 admin]$ srvctl stop listener -n rac1
[oracle@rac1 admin]$ srvctl stop listener -n rac2
[oracle@rac1 admin]$ srvctl start listener -n rac1
[oracle@rac1 admin]$ srvctl start listener -n rac2

检查asm实例

[oracle@rac1 admin]$ export ORACLE_SID=+ASM1
[oracle@rac1 admin]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1. - Production on Thu Jun :: Copyright (c) , , Oracle. All rights reserved. Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1. - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options SQL> conn sys/@192.168.1.142:/+ASM as sysdba
Connected.

源端:

2.安装 Goldengate

tar xvf xxxxxx.tar.gz

cd xxxx

[oracle@rac1 oracle]$ ./ggsci
GGSCI (rac1) > create subdirs

[oracle@gg gg]$ ./ggsci

配置gg的mgr端口,目标端也需要做同样的配置

GGSCI (gg) 5> edit param mgr
GGSCI (gg) 5> view param mgr
port 7809
GGSCI (gg) 5> start mgr
GGSCI (gg) 5> info mgr

--安装完毕

3.数据库的环境准备,需添加附加日志

原数据库Oracle
----》alter database add supplemental log data; //添加附加信息
Alter system switch logfile;
查看 select supplemental_log_data_min from v$database; 必须是yes

4.Goldengate同步用户,我默认用system,避免权限纠结..

5.进入./ggsci 打开要同步的表的附件日志信息

GGSCI (rac1) > dblogin userid system@rac1,password
或者
GGSCI (rac1) 3> dblogin userid [email protected]:/rac,password 111111
--添加附加日志的表
Add trandata gg.t1 或 gg.*

6.此步骤添加抓取进程,和传输进程,wan代表抓取进程,pwan代表传输进程

GGSCI (rac1) 8> edit param wan
GGSCI (rac1) 8> view param wan
EXTRACT WAN
USERID [email protected]:1521/rac,PASSWORD wan --登录的用户
TRANLOGOPTIONS ASMUSER sys@ASM,ASMPASSWORD 111111 --登录asm的
EXTTRAIL ./dirdat/et --抓取的数据放这里
TABLE wan.t1; --抓取的表 GGSCI (rac1) 8> Add Extract wan, TranLog, Begin Now threads 2 --rac有几个threads 2 就写几个
GGSCI (rac1) 8> Add ExtTrail ./dirdat/et, Extract wan, Megabytes 5 --建立./dirdat/et文件为5m GGSCI (rac1) 10> edit param pwan
GGSCI (rac1) 11> view param pwan
EXTRACT pwan
RMTHOST 192.168.1.105,MGRPORT 7809,COMPRESS --传输给目标数据库服务器
RMTTRAIL ./dirdat/ww --远程目标存放的数据文件
passthru
TABLE wan.t1; GGSCI (rac1) 11> Add Extract pwan, ExtTrailSource ./dirdat/et --传输进程pwan,提取的数据文件路径
GGSCI (rac1) 11> Add RmtTrail ./dirdat/ab, Extract psalesab, Megabytes 5 --建立目标数据库的数据文件./dirdat/ab为5m
GGSCI (rac1) > start extract *  --启动建立好的进程
GGSCI (rac1) > info all Program Status Group Lag Time Since Chkpt MANAGER RUNNING
EXTRACT RUNNING PWAN :: ::
EXTRACT RUNNING WAN :: ::
view report wan log  --如果不能启动,用此命令查看日志

目标端

说明:目标端创建个写入进程,我命名为rwan

1.安装 Goldengate

tar xvf xxxxxx.tar.gz

cd xxxx

[oracle@rac1 oracle]$ ./ggsci
GGSCI (rac1) 2> create subdirs

[oracle@gg gg]$ ./ggsci

配置gg的mgr端口,源端也需要做同样的配置

GGSCI (gg) > edit param mgr
GGSCI (gg) > view param mgr
port
GGSCI (gg) > start mgr
GGSCI (gg) > info mgr

配置检查数据一致性的表

编辑全局数据文件   //添加检查数据一致性的表
Edit params ./GLOBALS
CHECKPOINTTABLE system.checkpointtable
保存
创建表
Dblogin userid system, password oracle
Add checkpointtable

添加rwan配置文件

GGSCI (gg) > view param rwan

replicat rwan
userid system,password
HANDLECOLLISIONS
ASSUMETARGETDEFS
--ddl include all
--ddlerror default ignore retryop
discardfile ./dirrpt/rwan.dsc,append
map wan.t1, target chis.t1;

添加rwan进程

GGSCI (gg) 8> Add Replicat rwan, ExtTrail ./dirdat/ww

启动 start replicat rwan

GGSCI (gg) 9> info all

Program     Status      Group       Lag           Time Since Chkpt

MANAGER     RUNNING

REPLICAT    RUNNING     RWAN        00:00:00      00:00:07

到此就配置成功了。

总结

源端数据库对某表,做了dll操作,目标端已打补丁的方式添加,添加后,需对rwan进程重启一次。

再配置过程中参考了如下文章:

https://blogs.oracle.com/imc/entry/oracle_goldengate_configuring_ddl_replication

http://www.ibmdba.com/?p=129

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/goldengate/11g/orcl_orcl/index.html

05-19 06:59