安装
1.环境
ip | database version | ogg version |
---|---|---|
192.168.5.31 | 19c | 21c |
192.168.5.32 | 19c | 21c |
2.上传文件解压缩
mkdir /app
chown oracle /app -R
mkdir /app/ogg_ma -p
mkdir /app/ogg_sm -p
mkdir /app/deploy -p
chown oracle:oinstall /app/ogg_ma
chown oracle:oinstall /app/ogg_sm
chown oracle:oinstall /app/deploy
unzip /setup/fbo_ggs_Linux_x64_Oracle_services_shiphome
3.安装
su - oracLe
cd /setup/fbo_ggs_Linux_x64_Oracle_services_shiphome/Disk1
./runInstaller
4.添加环境变量
alias sqlplus='rlwrap sqlplus'
export ORACLE_HOME=ORCLDB
export ORACLE_BASE=/opt/oracle/
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
PATH=$ORACLE_HOME/bin:$PATH;
export PATH
-------------------------------------------------------------------------------------
export OGG_HOME=/app/ogg_ma
export TNS_ADMIN=/opt/oracle/product/19c/dbhome_1/network/admin
export LD_LIBRARY_PATH=/opt/oracle/product/19c/dbhome_1/lib
5.运行oggca.sh来配置微服务
cd /app/ogg_ma/bin/
./oggca.sh
选择新创建服务管理且勾选注册成系统服务,其中xag与rac结合的一个插件来管理ogg,本次没有使用,所以没有勾选
简单密码取消强度限制
6.查看服务
systemctl status OracleGoldenGate.service
http://ip:7809 管理控制台
- Admin server: 用于创建用户、添加附加日志、创建抽取和投递进程,类似在ggsci命令下添加附加日志、extract、replicat进程
- Distribution server:用于创建传输进程,类似于以前的pump进程
- Receiver server:用于监控接收进程,类似于以前的server collector进程
- Performance metrics server:性能监控,这个里面信息非常多,例如ADMINSRVR包括进程性能,线程性能以及进程状态与配置,非常详细与直观。
数据库环境准备
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;
<a name="JPiaK"></a>
#### 2.创建用户
注意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’);
<a name="zTvYU"></a>
### 配置数据源和进程
<a name="w9Ux0"></a>
#### 配置OGG的经典抽取(classic extract)进程
<br />添加数据源,配置检查点表和trandata及脉动<br />注意使用cdb 链接<br />
<a name="Ryvx4"></a>
### 添加抽取进程
注意注册pdb ,如果没有这个选项说明上面权限没弄好<br /><br /><br /><br />
<a name="tBc2Y"></a>
#### 编辑抽取进程参数
EXTRACT ex USERIDALIAS oggadmin DOMAIN oggadmin EXTTRAIL /app/dirdata/e1 DDL INCLUDE MAPPED DDLOPTIONS REPORT TRANLOGOPTIONS EXCLUDETAG 99 table ORCLPDB1.OGGADMIN.*; ###容器数据库同步写法
编辑replicate 进程<br />target数据源 创建检查表<br />
添加replicate 进程<br /><br />同步进程参数
REPLICAT rep USERIDALIAS target DOMAIN target DDL INCLUDE MAPPED DDLOPTIONS REPORT DBOPTIONS SETTAG 99 MAP ., TARGET .; ```