当前位置:   article > 正文

OGG19C远程部署方式,最佳抽取方式_goldengate 的远程抽取功能 remote extract

goldengate 的远程抽取功能 remote extract

OGG实战+ORACLE到ORACLE同步配置

前言:

OGG远程部署方式,最佳抽取方式。

OGG版本:19.1
操作系统版本:linux 7

一、数据库配置

1.1 开启归档

  1. startup mount
  2. alter database archivelog;

note:作为目标端,不capture数据不需要配置

1.2 开启强制日志

  1. alter database force logging;

note:作为目标端,不capture数据不需要配置

1.3 开启数据库最小附加日志

  1. alter database add supplemental log data;

note:作为目标端,不capture数据不需要配置

1.4 配置参数

  1. alter system set enable_goldengate_replication=true;

note:11.2.0.4以上需要配置

1.5 创建OGG用户和表空间

表空间

  1. create tablespace ggtbs datafile '+DATA' size 1g autoextend on;

用户

  1. create user ggadmin identified by ggadmin default tablespace ggtbs quota unlimited on ggtbs;

授权

  1. grant connect,resource to ggadmin;
  2. grant alter session to ggadmin;
  3. grant select any dictionary to ggadmin;
  4. grant select any transaction to ggadmin;
  5. grant select any table to ggadmin;
  6. grant flashback any table to ggadmin;
  7. grant alter any table to ggadmin;
  8. exec dbms_goldengate_auth.grant_admin_privilege('GGADMIN','*',TRUE)

note:除了必要权限,其他权限可以根据实际情况而定。

二、OGG安装

2.1 创建用户和目录

  1. groupadd oinstall

用户

  1. useradd -g oinstall oracle
  2. passwd oracle

目录

  1. mkdir /ogg/oraclient -p
  2. mkdir /ogg/ogg191
  3. mkdir /ogg/oraInventory
  4. chown oracle:oinstall -R /ogg
  5. chmod 775 -R /ogg

2.2 配置环境变量

  1. export ORACLE_HOME=/ogg/oraclient/instantclient_11_2
  2. export GG_HOME=/ogg/ogg191
  3. export LD_LIBRARY_PATH=$ORACLE_HOME:$GG_HOME
  4. export PATH=$ORACLE_HOME:$GG_HOME:$PATH
  5. alias ggsci='cd GG_HOME; ggsci'

2.3 Oracle客户端静默安装

note:最基础客户端包即可

  1. unzip -d /ogg/oraclient instantclient-basic-linux.x64-11.2.0.4.0

2.4 OGG静默安装

解压

  1. unzip 19.1.0.0.4-for-Oracle-on-Linux x86-64

编辑响应文件

  1. vi /home/oracle/fbo_ggs_Linux_x64_shiphome/Disk1/response/oggcore.rsp
  1. INSTALL_OPTION=ORA11g
  2. SOFTWARE_LOCATION=/ogg/ogg191
  3. START_MANAGER=
  4. MANAGER_PORT=
  5. DATABASE_LOCATION=
  6. INVENTORY_LOCATION=/ogg/oraInventory
  7. UNIX_GROUP_NAME=oinstall

静默安装

  1. ./runInstaller -silent -showProgress -responseFile /home/oracle/fbo_ggs_Linux_x64_shiphome/Disk1/response/oggcore.rsp

三、OGG配置

note:以下配置均为远程捕获和交付的方式,无需在数据库本地安装部署。

3.1 配置TNS

创建目录

  1. mkdir -p /ogg/oraclient/instantclient_11_2/network/admin

配置tnsnames.ora

  1. vi tnsnames.ora
  1. 源端库
  2. WLDB=
  3. (DESCRIPTION =
  4. (ADDRESS = (PROTOCOL = TCP)(HOST = XXXXXX)(PORT = 1521))
  5. (CONNECT_DATA =
  6. (SERVER = DEDICATED)
  7. (SERVICE_NAME = WLDB)
  8. )
  9. )
  10. 目标库
  11. TARGET=
  12. (DESCRIPTION =
  13. (ADDRESS = (PROTOCOL = TCP)(HOST = XXXXXX)(PORT = 1521))
  14. (CONNECT_DATA =
  15. (SERVER = DEDICATED)
  16. (SERVICE_NAME = WLDB)
  17. )
  18. )

3.2 创建ogg目录

登录ogg交互工具

  1. ggsci

创建目录

  1. create subdirs

3.3 配置MGR进程

编辑参数

  1. edit param mgr
  2. PORT 7809
  3. DYNAMICPORTLIST 7810-7899
  4. AUTORESTART ER *,RETRIES 5,WAITMINUTES 3
  5. PURGEOLDEXTRACTS ./dirdat/*,usecheckpoints, minkeepdays 7
  6. LAGREPORTHOURS 1
  7. LAGINFOMINUTES 30
  8. LAGCRITICALMINUTES 45

启动

  1. start mgr

查看

  1. info all

3.4 配置用户凭证

配置

  1. add credentialstore
  2. alter credentialstore add user ggadmin@wldb, password Oggadmin_#123 alias wldb
  3. alter credentialstore add user ggadmin@target, password Oggadmin_#123 alias target

验证

  1. dblogin useridalias wldb

3.5 配置extract进程

3.5.1 经典模式

添加附加日志

  1. dblogin useridalias wldb
  2. add trandata test.*

添加进程

  1. add extract wl_e, tranlog, begin now,threads 2 --节点数
  2. add exttrail ./dirdat/wl, extract wl_e, MEGABYTES 1024

配置参数

  1. edit param wl_e
  2. EXTRACT wl_e
  3. SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
  4. USERIDALIAS wldb
  5. TRANLOGOPTIONS dblogreader
  6. LOGALLSUPCOLS
  7. GETTRUNCATES
  8. EXTTRAIL ./dirdat/wl
  9. DISCARDFILE ./dirrpt/wl_e.dsc, APPEND, MEGABYTES 1024
  10. WARNLONGTRANS 1H, CHECKINTERVAL 5M
  11. CACHEMGR CACHESIZE 1024MB, CACHEDIRECTORY ./dirtmp
  12. REPORTCOUNT EVERY 60 SECONDS, RATE
  13. TABLE test.*;

Note:dblogreader最低支持版本为11.2.0.4,通过数据字典的方式获取日志信息,需要select any transaction权限

启动

  1. start wl_e

查看

  1. info all

3.5.2 集成模式

note:推荐集成模式,性能更好,原理是整合logminer,多租户环境只能用集成模式

数据库stream参数调整,一个进程建议1.25g

  1. alter system set streams_pool_size=10g;

添加附加日志

  1. dblogin useridalias wldb
  2. add trandata test.*

添加进程

  1. ADD EXTRACT ie_e INTEGRATED TRANLOG BEGIN NOW
  2. ADD EXTTRAIL ./dirdat/ie EXTRACT ie_e MEGABYTES 1024

注册进程

  1. dblogin useridalias wldb
  2. REGISTER EXTRACT ie_e DATABASE

编辑参数

  1. edit param ie_e
  2. EXTRACT ie_e
  3. USERIDALIAS wldb
  4. LOGALLSUPCOLS
  5. NOCOMPRESSUPDATES
  6. UPDATERECORDFORMAT FULL
  7. DBOPTIONS ALLOWUNUSEDCOLUMN
  8. FETCHOPTIONS NOUSESNAPSHOT
  9. GETTRUNCATES
  10. EXTTRAIL ./dirdat/ie
  11. DISCARDFILE ./dirrpt/ie_e.dsc, PURGE, MEGABYTES 1024
  12. WARNLONGTRANS 1H, CHECKINTERVAL 5M
  13. CACHEMGR CACHESIZE 1024MB, CACHEDIRECTORY ./dirtmp
  14. REPORTCOUNT EVERY 60 SECONDS, RATE
  15. TABLE test.*;

Note:因为通过logminer挖掘日志,日志参数无需指定,可以利用参数配置logminer的并发数和内存大小

启动

  1. start ie_e

查看

  1. info all

3.6 配置pump进程

添加进程

  1. add extract wl_p EXTTRAILSOURCE ./dirdat/wl
  2. add rmttrail /ogg/ogg191/dirdat/wl extract wl_p MEGABYTES 1024

编辑参数

  1. edit param wl_p
  2. EXTRACT wl_p
  3. DISCARDFILE ./dirrpt/wl_p.dsc, APPEND, MEGABYTES 1024
  4. RMTHOST 192.168.3.132, MGRPORT 7809
  5. RMTTRAIL /ogg/ogg191/dirdat/wl
  6. PASSTHRU
  7. TABLE test.*;

启动进程

  1. start wl_p

查看

  1. info all

3.7 配置replicat进程

添加数据库检查点表

  1. dblogin useridalias target
  2. add checkpointtable ggadmin.checkpoint

添加进程

  1. ADD REPLICAT wl_r EXTTRAIL /ogg/ogg191/dirdat/wl checkpointtable ggadmin.checkpoint

编辑参数

  1. edit param wl_r
  2. REPLICAT wl_r
  3. USERIDALIAS target
  4. REPERROR (DEFAULT, ABEND)
  5. DISCARDFILE ./dirrpt/wl_r.dsc, PURGE, MEGABYTES 1024
  6. GETTRUNCATES
  7. ALLOWNOOPUPDATES
  8. REPORTCOUNT EVERY 60 SECONDS, RATE
  9. MAP test.*, TARGET test.*;

登录后复制

启动

  1. start wl_r

查看

info all
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/587419
推荐阅读
相关标签
  

闽ICP备14008679号