OGG bi-directional replication for Oracle DB
Overview of an Active-Active Configuration
Oracle GoldenGate supports an active-active bi-directional configuration, where there are two systems with identical sets of data that can be changed by application users on either system. Oracle GoldenGate replicates transactional data changes from each database to the other to keep both sets of data current.
In a bi-directional configuration, there is a complete set of active Oracle GoldenGate processes on each system. Data captured by an Extract process on one system is propagated to the other system, where it is applied by a local Replicat process.
This configuration supports load sharing. It can be used for disaster tolerance if the business applications are identical on any two peers. Bidirectional synchronization is supported for all database types that are supported by Oracle GoldenGate.
Oracle GoldenGate supports active-active configurations for:
· DB2 on z/OS, LUW, and IBM i
· MySQL
· Oracle
· SQL Server
· Teradata
Oracle GoldenGate supports DDL replication in an Oracle active-active configuration. DDL support is available for Oracle Database, MySQL, and Teradata databases.
Preventing Data Looping
In a bidirectional configuration, SQL changes that are replicated from one system to another must be prevented from being replicated back to the first system. Otherwise, it moves back and forth in an endless loop, as in this example:
- A user application updates a row on system A.
- Extract extracts the row on system A and sends it to system B.
- Replicat updates the row on system B.
- Extract extracts the row on system B and sends it back to system A.
- The row is applied on system A (for the second time).
- This loop continues endlessly.
To prevent data loopback, you may need to provide instructions that:
- prevent the capture of SQL operations that are generated by Replicat, but enable the capture of SQL operations that are generated by business applications if they contain objects that are specified in the Extract parameter file.
- identify local Replicat transactions, in order for the Extract process to ignore them.
Preventing the Capture of Replicat Transactions (Oracle)
To prevent the capture of SQL that is applied by Replicat to an Oracle database, there are different options depending on the Extract capture mode:
· When Extract is in classic or integrated capture mode, use the TRANLOGOPTIONS
parameter with the EXCLUDETAG
tag
option. This parameter directs the Extract process to ignore transactions that are tagged with the specified redo tag.
· When Extract is in classic capture mode, use the Extract TRANLOGOPTIONS
parameter with the EXCLUDEUSER
or EXCLUDEUSERID
option to exclude the user name or ID that is used by Replicat to apply the DDL and DML transactions. Multiple EXCLUDEUSER
statements can be used. The specified user is subject to the rules of the GETREPLICATES
or IGNOREREPLICATES
parameter.
Identifying Replicat Transactions (Oracle)
There are multiple ways to identify Replicat transaction in an Oracle environment. When Replicat is in classic or integrated mode, you use the following parameters:
- Use DBOPTIONS with the SETTAG option in the Replicat parameter file. Replicat tags the transactions being applied with the specified value, which identifies those transactions in the redo stream. The default SETTAG value is 00. Valid values are a single TAG value consisting of hexadecimal digits.
- Use the TRANLOGOPTIONS parameter with the EXCLUDETAG option in the Extract parameter file. The logmining server associated with that Extract excludes redo that is tagged with the SETTAG value.
· By using SETTAG and EXCLUDETAG you have more flexibility on how you configure replication between various databases. For Oracle Database 12c container databases this is the only option to avoid data looping.
The following shows how SETTAG can be set in the Replicat parameter file:
dboptions settag 0935
The following shows how EXCLUDETAG can be set in the Extract parameter file:
tranlogoptions excludetag 0935
If you are excluding multiple tags, each must have a separate TRANLOGOPTIONS EXCLUDETAG statement specified.
You can also use the transaction name or userid of the Replicat user to identify Replicat transactions. You can choose which of these to ignore when you configure Extract.
Configuration for DDL replication
After Oracle GoldenGate 12.1.2, you no longer need to run the SQL scripts such as marker_setup.sql and ddl_setup.sql to set up the DDL replication. Using the GoldenGate Integrated Capture for Oracle Database, the native DDL replication is very easy to setup.
You need to use DDL INCLUDE to specify what DDL operations you need to capture. The following example includes ALL the DDL operations. To enable replication of the newly added tables, we can also add the DDLOPTIONS ADDTRANDATA in the parameter file or run ADD SCHEMATRANDATA in GGCSI.
ddl include all
ddloptions addtrandata, report
Creating an Active-Active configuration
The figure shows Oracle GoldenGate Configuration for Active-active Synchronization. In below example, the configuration would be deployed between Oracle 12c pdbs. We will configure pdbsrc as primary system, pdbtgt as secondary system.
Prerequisites
Open Archive Log:
SQL>startup mount;
SQL>alter database archivelog;
SQL>alter database open;
Open supplemental log data and force logging:
SQL>SELECT supplemental_log_data_min, force_logging FROM v$database;
SQL>alter database add supplemental log data;
SQL>alter database force logging;
SQL>ALTER SYSTEM switch logfile;
Enabling Oracle GoldenGate in the Database:
SQL> alter system set enable_goldengate_replication = true scope=both;
Create OGG Users
SQL> startup
SQL> alter PLUGGABLE database all open;
SQL>create user c##oggadmin identified by oracle;
SQL>GRANT DBA to c##oggadmin container=all;
SQL> exec dbms_goldengate_auth.grant_admin_privilege('c##oggadmin',container=>'ALL');
SQL> alter session set container=pdbsrc;
SQL> create user west identified by oracle;
SQL> grant connect,resource to west;
SQL> alter user west quota unlimited on users;
SQL> alter session set container=pdbtgt;
SQL> create user east identified by oracle;
SQL> grant connect,resource to east;
SQL> alter user east quota unlimited on users;
Configuration from Primary System to Secondary System (pdbsrc to pdbtgt)
Configure the Extract Process (pdbsrc)
GGSCI (orcl) 59> view param etwest
extract etwest
userid c##oggadmin,password oracle
exttrail ./dirdat/ew
ddl include all
TranLogOptions Excludetag 00
sourcecatalog pdbsrc
table west.*;
GGSCI (orcl) 1> add extract etwest,integrated tranlog, begin now
GGSCI (orcl) 2> add exttrail ./dirdat/ew, extract etwest, megabytes 20
GGSCI (orcl) 5> dblogin userid c##oggadmin, password oracle
GGSCI (orcl as c##oggadmin@disdb/CDB$ROOT) 6> register extract etwest database container(pdbsrc)
GGSCI (orcl as c##oggadmin@disdb/CDB$ROOT) 7> add schematrandata pdbsrc.west
Configure the Data Pump Process (pdbsrc)
GGSCI (orcl) 60> view param pmwest
extract pmwest
passthru
rmthost orcl,mgrport 7909
rmttrail ./dirdat/rw
table pdbsrc.west.*;
GGSCI (orcl) 3> add extract pmwest, exttrailsource ./dirdat/ew
GGSCI (orcl) 4> add rmttrail ./dirdat/rw, extract pmwest, megabytes 20
Configure the Replicat Process (pdbtgt)
GGSCI (orcl) 61> view param rpeast
replicat rpeast
userid c##oggadmin@pdbsrc, password oracle
discardfile rpeast.dsc, append, megabytes 10
ddl include all
map pdbtgt.east.*, target pdbsrc.west.*;
GGSCI (orcl) 8> add replicat rpeast, integrated ,exttrail ./dirdat/re
Configuration from Secondary System to Primary System (pdbtgt to pdbsrc)
Configure the Extract Process (pdbtgt)
GGSCI (orcl) 135> view param eteast
extract eteast
userid c##oggadmin,password oracle
exttrail ./dirdat/ee
ddl include all
TranLogOptions Excludetag 00
sourcecatalog pdbtgt
table east.*;
GGSCI (orcl) 2> add extract eteast,integrated tranlog, begin now
GGSCI (orcl) 3> add exttrail ./dirdat/ee, extract eteast, megabytes 20
GGSCI (orcl) 6> dblogin userid c##oggadmin, password oracle
GGSCI (orcl as c##oggadmin@disdb/CDB$ROOT) 7> register extract eteast database container(pdbtgt)
GGSCI (orcl as c##oggadmin@disdb/CDB$ROOT) 8> add schematrandata pdbtgt.east
Configure the Data Pump Process (pdbtgt)
GGSCI (orcl) 136> view param pmeast
extract pmeast
passthru
rmthost orcl,mgrport 7809
rmttrail ./dirdat/re
table pdbtgt.east.*;
GGSCI (orcl) 1> add replicat rpwest, integrated ,exttrail ./dirdat/rw
GGSCI (orcl) 4> add extract pmeast, exttrailsource ./dirdat/ee
Configure the Replicat Process (pdbsrc)
GGSCI (orcl as c##oggadmin@disdb/CDB$ROOT) 138> view param rpwest
replicat rpwest
userid c##oggadmin@pdbtgt, password oracle
discardfile rpwest.dsc, append, megabytes 10
ddl include all
map pdbsrc.west.*, target pdbtgt.east.*;
GGSCI (orcl) 5> add rmttrail ./dirdat/re, extract pmeast, megabytes 20
OGG bi-directional replication for Oracle DB的更多相关文章
- Oracle GoldenGate (以下简称ogg)在异种移植os同一种db之间的数据同步。
Oracle GoldenGate (以下简称ogg)在异种移植os同一种db之间的数据同步. ogg要实现的功能: 同步可以细化到单个表,满足特定的where条件rows同步,称号column同步. ...
- goldengate 12c对oracle DB的改进
1. 现在可使用Oracle Universal Installer,即安装时有图形化界面,同时会自动安装java runtime environment,不过个人认为,还是ZIP安装包方便,解压即用 ...
- Oracle GoldenGate从oracle db 到非oracle db的初始化数据同步的方法
非oracle db以 sqlserver为样例说明: 我的思路 A :oracle db 生产 B: oracle db 中间机 C: sqlserver db 目的端 A-> B-> ...
- 在silverlight中通过WCF连接ORACLE DB数据库(转)
转自 http://hi.baidu.com/qianlihanse/item/458aa7c8d93d4e0cac092ff4 这不是我的原创,我也是上网学习的~ How to get data f ...
- Oracle DB 存储增强
• 设置Automatic Storage Management (ASM) 快速镜像 再同步 • 使用ASM 首选镜像读取 • 了解可伸缩性和性能增强 • 设置ASM 磁盘组属性 • 使用SYSA ...
- Oracle DB 使用调度程序自动执行任务
• 使用调度程序来简化管理任务 • 创建作业.程序和调度 • 监视作业执行 • 使用基于时间或基于事件的调度来执行调度程序作业 • 描述窗口.窗口组.作业类和使用者组的用途 • 使用电子邮件通知 • ...
- Oracle DB 管理数据库的空间
• 描述4 KB 扇区磁盘的概念及使用 • 使用可移动表空间 • 描述可移动表空间的概念 数据库存储 数据库存储 数据库包括物理结构和逻辑结构.由于物理结构和逻辑结构是分开的,因此管理数据的物 理存储 ...
- Oracle DB 执行表空间时间点恢复
• 列出在执行表空间时间点恢复(TSPITR) 时会发生的操作 • 阐释TSPITR 使用的术语的定义 • 确定适合将TSPITR 用作解决方案的情况 • 确定时间点恢复的正确目标时间 • 确定不能使 ...
- Oracle DB 备份和恢复的概念
• 确定Oracle DB 中可能发生的故障类型 • 说明优化实例恢复的方法 • 说明检查点.重做日志文件和归档日志文件的重要性 • 配置快速恢复区 • 配置ARCHIVELOG模式 部分工作内容 ...
随机推荐
- tensorflow在文本处理中的使用——辅助函数
代码来源于:tensorflow机器学习实战指南(曾益强 译,2017年9月)——第七章:自然语言处理 代码地址:https://github.com/nfmcclure/tensorflow-coo ...
- H3C 端口隔离简介
- 常用MouseEvent鼠标事件对象&KeyboardEvent键盘事件对象&常用键盘码
MouseEvent鼠标事件对象: e.target //=> 事件源(操作的是哪个元素) e.clientX e.clientY //当前鼠标触发点距离当前窗口左上角的X|Y轴坐标 e.pag ...
- 关于react打包之后静态资源加载错误的问题
之前在打包react项目时发现一些问题,打包出来后我的一部分png图标加载不出来,开发者模式发现他们的路径中莫名其妙混入了我在react-router路由中使用<Browserrouter> ...
- Maven 运行 tomcat:run 时出现 Unable to compile class for JSP...
近来无事便去看了看神奇的 Maven , 但写第一个 Hello,World 就非常不友好的怼给我一个 500, 很是郁闷; 开发环境: JDK1.8, Maven 3.5 项目目录: \maven_ ...
- destoon信息或者公司归属多个类别的解决方式
有时候,一条信息属对应于多个类别,在destoon原生系统里是没有这个解决方案 在公司行业类别选择的地方实现了这个功能,但是选择体验不太好,不符合我当前的需求,目前我写了如下解决方案 系统代码如下: ...
- C++Review1_多态和虚函数
继承是实现多态的基础.虚函数是实现多态的方法.虚函数.多态.继承都是紧密相关的概念.而继承是所有概念的基础: 多态:简单来讲就是接口一样,实现多样.多态是指通过基类的指针或者引用,在运行时动态调用实际 ...
- FPM简介(定制rpm包)
FPM简介 fpm是生成rpm包的工具.rpm包的制作,采用fpm工具完成,FPM非常易用,此命令可以把rpm包的安装.卸载做得更加优雅,在安装前可以做一些准备工作,安装后可以做一些收尾工作,在卸载前 ...
- 【题解】CF1056F Write the Contest(三分+贪心+DP)
[题解]CF1056F Write the Contest(三分+贪心+DP) 最优化问题的三个解决方法都套在一个题里了,真牛逼 最优解应该是怎样的,一定存在一种最优解是先完成了耗时长的任务再干别的( ...
- 语言篇:Java环境
语言篇:Java环境 Java是什么? Java 是一项用于开发应用程序的技术语言,可以让 Web 变得更有意思和更实用.使用 Java 可以玩游戏.上载照片.联机聊天以及参与虚拟体验,并能够使用联机 ...