collector是目标端后台进程,默认情况下,源端extract进程初始化TCP/IP连接到目标端的collector进程,但是因为GoldenGate是可配置的,所以有些时候可能需要在目标端配置和初始化collector,比如目标端同步时区,但是源端的时区小于目标端的情况下。collector的功能:1.根据源端extract进程的请求,扫描和绑定可用的端口给mgr主进程分配给请求的extract进程;2.接收源端extract抽取trail并写入到目标端的trail文件;mgr自动启动collector进程当源端发出网络请求时,所以GoldeGate用户是不可以与它交互的。collector只能同时接受一个extract进程信息(一对一)并且随着extract的终止而终止。
2.目录和环境变量设置实验分别在同一台机器上的/u01/app/product/ogg_src目录下安装源端,/u01/app/product/ogg_trg目录下安装目标端为例;
[oracle@sywu ~]$ mkdir -p /u01/app/product/ogg_src [oracle@sywu ~]$ mkdir -p /u01/app/product/ogg_trg [oracle@sywu ~]$ ls /u01/app/product 11.2.3 ogg_src ogg_trgLinux下安装GoldenGate要配置ORACLE_SID、ORACLE_HOME和LD_LIBRARY_PATH;
export ORACLE_BASE=/u01 export ORACLE_HOME=$ORACLE_BASE/app/product/11.2.3/db_1 export ORACLE_SID=sydb export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32 alias sqlplus='rlwrap sqlplus' alias rman='rlwrap rman' alias nmon='/usr/nmon/nmon_x86_CentOS6' alias bbed='rlwrap bbed' PATH=$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch export PATH注意:数操作系统版本、据库版本和Oracle GoldenGate版本bit type要一致,要么全是32bit要么全是64bit;
3.安装GoldenGate 3.1.安装源端GoldenGate [oracle@sywu ~]$ unzip 121210_fbo_ggs_Linux_x64_shiphome.zip -d /tmp [oracle@sywu ~]$ /tmp/fbo_ggs_Linux_x64_shiphome/Disk1/runInstaller根据数据库版本选择对应的GoldenGate选项;
更改GoldenGate Software 安装位置,将其安装到/u01/app/product/ogg_src目录下,检查数据库安装位置是否正确,并配置端口;
检查安装信息,确认无误后开始安装;
这样源端的安装就完成了。 3.2.安装目标端GoldenGate
目标端的配置和安装与源端的安装步骤上都相同,唯一不同的地方是如果在同一台机器上安装源端和目标端,则要将其安装在不同的目录下(此处是/u01/app/product/ogg_trg),并且配置不同的端口(此处是7909);
安装完成后配置OGG命令行快捷命令和回写功能,在.bash_profile配置文件中添加如下内容: alias tggsci='rlwrap /u01/app/product/ogg_trg/ggsci' alias sggsci='rlwrap /u01/app/product/ogg_src/ggsci'
上面通过别名的方式配置了源端的OGG ggsci命令sggsci,目标端的OGG ggsci命令tggsci并通过rlwrap 使其支持回写功能,这样在任何位置都可以使用OGG ggsci命令;
[oracle@sywu ~]$ which tggsci alias tggsci='rlwrap /u01/app/product/ogg_trg/ggsci' /usr/local/bin/rlwrap [oracle@sywu ~]$ which sggsci alias sggsci='rlwrap /u01/app/product/ogg_src/ggsci' /usr/local/bin/rlwrap [oracle@sywu ~]$ sggsci Oracle GoldenGate Command Interpreter for Oracle Version 12.1.2.1.0 OGGCORE_12.1.2.1.0_PLATFORMS_140727.2135.1_FBO Linux, x64, 64bit (optimized), Oracle 11g on Aug 7 2014 09:14:25 Operating system character set identified as UTF-8. Copyright (C) 1995, 2014, Oracle and/or its affiliates. All rights reserved. GGSCI (sywu) 1> exit [oracle@sywu ~]$ tggsci Oracle GoldenGate Command Interpreter for Oracle Version 12.1.2.1.0 OGGCORE_12.1.2.1.0_PLATFORMS_140727.2135.1_FBO Linux, x64, 64bit (optimized), Oracle 11g on Aug 7 2014 09:14:25 Operating system character set identified as UTF-8. Copyright (C) 1995, 2014, Oracle and/or its affiliates. All rights reserved. GGSCI (sywu) 1> exit [oracle@sywu ~]$该版本默认已经自动建立子目录,安装完成后查看mgr进程应为running状态;
GGSCI (sywu) 1> view param mgr PORT 7909 GGSCI (sywu) 2> info mgr Manager is running (IP port sywu.7909, Process ID 16870). 4.GoldenGate目录结构 说明后缀名目录路径Parameter files .prm /u01/app/product/ogg_src/dirprm
Report files .rpt /u01/app/product/ogg_src/dirrpt
Checkpoint files .cpr /u01/app/product/ogg_src/dirchk
Process status files .pcs /u01/app/product/ogg_src/dirpcs
SQL script files .sql /u01/app/product/ogg_src/dirsql
Database definitions files .def /u01/app/product/ogg_src/dirdef
Extract data files /u01/app/product/ogg_src/dirdat
Temporary files /u01/app/product/ogg_src/dirtmp
Credential store files .crd /u01/app/product/ogg_src/dircrd
Masterkey wallet files .wlt /u01/app/product/ogg_src/dirwlt
Dump files .dmp /u01/app/product/ogg_src/dirdmp
5.总结