安装

1.环境

ip database version ogg version
192.168.5.31 19c 21c
192.168.5.32 19c 21c

2.上传文件解压缩

  1. mkdir /app
  2. chown oracle /app -R
  3. mkdir /app/ogg_ma -p
  4. mkdir /app/ogg_sm -p
  5. mkdir /app/deploy -p
  6. chown oracle:oinstall /app/ogg_ma
  7. chown oracle:oinstall /app/ogg_sm
  8. chown oracle:oinstall /app/deploy
  9. unzip /setup/fbo_ggs_Linux_x64_Oracle_services_shiphome

3.安装

  1. su - oracLe
  2. cd /setup/fbo_ggs_Linux_x64_Oracle_services_shiphome/Disk1
  3. ./runInstaller

image.png
image.png
image.png

4.添加环境变量

  1. alias sqlplus='rlwrap sqlplus'
  2. export ORACLE_HOME=ORCLDB
  3. export ORACLE_BASE=/opt/oracle/
  4. export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
  5. PATH=$ORACLE_HOME/bin:$PATH;
  6. export PATH
  7. -------------------------------------------------------------------------------------
  8. export OGG_HOME=/app/ogg_ma
  9. export TNS_ADMIN=/opt/oracle/product/19c/dbhome_1/network/admin
  10. export LD_LIBRARY_PATH=/opt/oracle/product/19c/dbhome_1/lib

5.运行oggca.sh来配置微服务

  1. cd /app/ogg_ma/bin/
  2. ./oggca.sh

选择新创建服务管理且勾选注册成系统服务,其中xag与rac结合的一个插件来管理ogg,本次没有使用,所以没有勾选
image.png
image.png
image.png
image.png
image.png
简单密码取消强度限制
image.png
image.png
image.png
image.png
image.png
image.png

6.查看服务

  1. systemctl status OracleGoldenGate.service

http://ip:7809 管理控制台

  1. Admin server: 用于创建用户、添加附加日志、创建抽取和投递进程,类似在ggsci命令下添加附加日志、extract、replicat进程
  • Distribution server:用于创建传输进程,类似于以前的pump进程
  • Receiver server:用于监控接收进程,类似于以前的server collector进程
  • Performance metrics server:性能监控,这个里面信息非常多,例如ADMINSRVR包括进程性能,线程性能以及进程状态与配置,非常详细与直观。

image.png

数据库环境准备

1.数据库参数准备

  • 开启数据库归档—如果没有开启
  • 开启数据库级别附加日志—如果没有开始最小附加日志
  • 开启强制日志—如果没有开启强制日志
  • 设置ENABLE_GOLDENGATE_REPLICAT参数为TRUE
  • 创建OGG用户包括包括源端用户、目标端用户以及OGG抽取用 ``` mkdir /opt/oracle/fast_recover_area

startup mount; alter database archivelog; alter system set dbrecovery_file_dest_size=20g scope=spfile; alter system set db_recovery_file_dest=’/opt/oracle/fast_recover_area’ scope=spfile; alter system set log_archive_dest_2=’LOCATION=USE_DB_RECOVERY_FILE_DEST’ scope=spfile; alter system set log_archive_format=”%t%s_%r.arc” scope=spfile; alter system set enable_goldengate_replication=TRUE scope=spfile; alter system set common_user_prefix=’’ scope=spfile; shutdown immediate; startup ; alter database add supplemental log data; alter database add supplemental log data (all) columns; alter database force logging; alter system set enable_goldengate_replication=TRUE; alter system set streams_pool_size = 50M scope=spfile; alter system set common_user_prefix=’’ scope=spfile;

  1. <a name="JPiaK"></a>
  2. #### 2.创建用户
  3. 注意ogg为操作同步的用户,同步的事oggadmin下面的表

——noncdb CREATE USER ogg identified by “12345”; GRANT DBA to ogg; grant SELECT ANY DICTIONARY to ogg; create user oggadmin identified by “oggadmin”; Grant connect, resource, create session, alter session to oggadmin; Grant unlimited tablespace to oggadmin; exec dbms_goldengate_auth.grant_admin_privilege(‘OGG’,PRIVILEGE_TYPE=>’*’,GRANT_SELECT_PRIVILEGES=>true);

———-pdb数据库同步创建用户 CREATE USER ogg identified by “12345” container=all; GRANT EXECUTE ON SYS.DBMS_LOCK TO ogg;
GRANT DBA to ogg container=all; GRANT SELECT ANY DICTIONARY to ogg container=all;

GRANT EXECUTE ON SYS.DBMS_LOCK TO oggadmin container=all; Grant connect, resource, create session, alter session to oggadmin; Grant unlimited tablespace to oggadmin; exec dbms_goldengate_auth.grant_admin_privilege(‘OGG’,PRIVILEGE_TYPE=>’*’,GRANT_SELECT_PRIVILEGES=>true,container=>’all’);

  1. <a name="zTvYU"></a>
  2. ### 配置数据源和进程
  3. <a name="w9Ux0"></a>
  4. #### 配置OGG的经典抽取(classic extract)进程
  5. ![image.png](https://cdn.nlark.com/yuque/0/2021/png/414613/1631684857858-91cf45d1-71b2-4b32-af21-65bde4d93a06.png#clientId=u0821808f-5cfc-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=623&id=u4323d214&margin=%5Bobject%20Object%5D&name=image.png&originHeight=623&originWidth=1741&originalType=binary&ratio=1&rotation=0&showTitle=false&size=76143&status=done&style=none&taskId=u13aea7fa-357a-482f-b62a-db0507bd232&title=&width=1741)<br />添加数据源,配置检查点表和trandata及脉动<br />注意使用cdb 链接<br />![image.png](https://cdn.nlark.com/yuque/0/2021/png/414613/1640743378397-0dfe77c0-2b96-402d-af91-3ee490a15db6.png#clientId=u4a5c0afd-fe6e-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=819&id=u78645ae5&margin=%5Bobject%20Object%5D&name=image.png&originHeight=819&originWidth=1913&originalType=binary&ratio=1&rotation=0&showTitle=false&size=68290&status=done&style=none&taskId=ued39c474-4a16-47dd-89dd-c5394548ad8&title=&width=1913)
  6. <a name="Ryvx4"></a>
  7. ### 添加抽取进程
  8. 注意注册pdb ,如果没有这个选项说明上面权限没弄好<br />![image.png](https://cdn.nlark.com/yuque/0/2021/png/414613/1640663175539-5f701dcb-8e18-449e-a6d4-dfba7f6231dd.png#clientId=u3a0d183c-c681-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=820&id=uce83467c&margin=%5Bobject%20Object%5D&name=image.png&originHeight=820&originWidth=1915&originalType=binary&ratio=1&rotation=0&showTitle=false&size=96441&status=done&style=none&taskId=ue38f4c6a-84da-47be-b362-6f94a29b7d4&title=&width=1915)<br />![image.png](https://cdn.nlark.com/yuque/0/2021/png/414613/1640663195437-d0b96432-46be-4be2-933d-3147118a74eb.png#clientId=u3a0d183c-c681-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=586&id=u8aec1bde&margin=%5Bobject%20Object%5D&name=image.png&originHeight=586&originWidth=1717&originalType=binary&ratio=1&rotation=0&showTitle=false&size=32182&status=done&style=none&taskId=uc5267e53-987d-41e1-b584-945a1e1c4e1&title=&width=1717)<br />![image.png](https://cdn.nlark.com/yuque/0/2021/png/414613/1640743478469-969e6d54-490c-4b30-8ed8-a21f5f93a143.png#clientId=u4a5c0afd-fe6e-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=929&id=ub346026d&margin=%5Bobject%20Object%5D&name=image.png&originHeight=929&originWidth=1877&originalType=binary&ratio=1&rotation=0&showTitle=false&size=89378&status=done&style=none&taskId=ua6902253-243b-4852-99fc-fc374b986fb&title=&width=1877)<br />![image.png](https://cdn.nlark.com/yuque/0/2021/png/414613/1640743499234-769ea896-46d7-48bc-a0e2-f5c96636e3a2.png#clientId=u4a5c0afd-fe6e-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=953&id=u0321dbc7&margin=%5Bobject%20Object%5D&name=image.png&originHeight=953&originWidth=1613&originalType=binary&ratio=1&rotation=0&showTitle=false&size=77840&status=done&style=none&taskId=u3bfa351a-a34b-4fd1-be2c-6ef9a757c52&title=&width=1613)
  9. <a name="tBc2Y"></a>
  10. #### 编辑抽取进程参数

EXTRACT ex USERIDALIAS oggadmin DOMAIN oggadmin EXTTRAIL /app/dirdata/e1 DDL INCLUDE MAPPED DDLOPTIONS REPORT TRANLOGOPTIONS EXCLUDETAG 99 table ORCLPDB1.OGGADMIN.*; ###容器数据库同步写法

  1. 编辑replicate 进程<br />target数据源 创建检查表<br />![image.png](https://cdn.nlark.com/yuque/0/2021/png/414613/1640744520442-862a74d7-5244-44ed-9e21-93a3af1a769d.png#clientId=u4a5c0afd-fe6e-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=563&id=u4283485a&margin=%5Bobject%20Object%5D&name=image.png&originHeight=563&originWidth=1647&originalType=binary&ratio=1&rotation=0&showTitle=false&size=37127&status=done&style=none&taskId=u5c096b49-eb6e-47ce-977c-93690a6e8bf&title=&width=1647)
  2. 添加replicate 进程<br />![image.png](https://cdn.nlark.com/yuque/0/2021/png/414613/1640744591209-6a0a4416-6607-4a07-95f3-4440e654310b.png#clientId=u4a5c0afd-fe6e-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=968&id=u7615de4a&margin=%5Bobject%20Object%5D&name=image.png&originHeight=968&originWidth=1665&originalType=binary&ratio=1&rotation=0&showTitle=false&size=86407&status=done&style=none&taskId=u7291dd8c-44ff-44d5-951d-2061dc0682f&title=&width=1665)<br />同步进程参数

REPLICAT rep USERIDALIAS target DOMAIN target DDL INCLUDE MAPPED DDLOPTIONS REPORT DBOPTIONS SETTAG 99 MAP ., TARGET .; ```