OGG How to Resync Tables / Schemas on Different SCN s in a Single Replicat
To resync one or more tables/schemas on different SCN's using a single or minimum number of replicats without using handlecollisions.
For example, when doing migrations and parallel exports are run.
This can be done with Oracle goldenGate (OGG) 11.1.1.0.x or higher.
Consider the following example with the schema HR and two tables TCUSTORD,
TCUSTMER
The syntax given below is for OGG v11.x.
Please see the NOTE at the end for OGG v12 and higher
1. Capture the SCN information in the extract trails using tokens
table hr.*, Tokens (tk-csn = @GETENV
("TRANSACTION", "CSN")) ;
Step 1 can be skipped if using OGG v11.1.1.1.x and it is needed if using OGG
v11.1.1.0.x
On OGG v11.1.1.1.x and higher the TOKEN is
not needed in the extract as the CSN/SCN is written
by default to the OGG trails
2. Do an SCN based export on source for the interested tables (first TCUSTMER,
then TCUSTORD in
our example)
exp hr/hr tables=hr.tcustmer grants=n statistics=none
triggers=n compress=n FLASHBACK_SCN=4746443
Then run another export on source for TCUSTORD at a different scn
exp hr/hr tables=hr.tcustord grants=n statistics=none
triggers=n compress=n FLASHBACK_SCN=4747033
3. Run the imports on target
4. Add the replicat on target to the beginning of the extract trail
Example parameter file:
replicat r1
userid myogguser password xyz
assumetargetdefs
discardfile dirrpt\r1.dsc, purge
map hr.tcustmer, target myogguser.* , Filter ( @NUMSTR (@TOKEN
("TK-CSN")) > 4746443);
map hr.tcustord, target myogguser.* , Filter ( @NUMSTR (@TOKEN
("TK-CSN")) > 4747033);
This is used to resync one or more tables/ schemas of different SCN's in the
same replicat.
If not using tokens
in the extract on step 1 (OGG versions 11.1 and higher) then the equivalent
mapping to use the
default SCN token from the trail would be
map hr.tcustmer,
target myogguser.* , FILTER ( @GETENV ("TRANSACTION",
"CSN") > 4746443);
map hr.tcustord, target myogguser.* , FILTER ( @GETENV
("TRANSACTION", "CSN") > 4747033);
This example is for a DML only replication setup using OGG version
11.1.1.0.x or higher
NOTE: For OGGv12 the double quotes needs to be replaced
with single quotes since OGG v12 uses ANSI SQL parameter by default
sample1;
1、停止抽取进程、传输进程、复制进程
stop e*
stop p*
stop r*
2、修改抽取进程、传输进程配置,新增表同步
extract:
table MM_PS.T_MCOUPONSINFO_HIS;
pump:
table MM_PS.T_MCOUPONSINFO_HIS;
3、源端增加表附加日志,并启动抽取、传输进程
dblogin userid goldengate password 123
add trandata MM_PS.T_MCOUPONSINFO_HIS
start e*
start p*
4、源端数据库获取当前最新scn
select dbms_flashback.get_system_change_number current_scn from dual;
10930121916224
5、源端数据库按照指定的scn导出表数据
exp mmdb03/*** direct=y rows=y buffer=64000000 flashback_scn=10930121916224 constraints=n grants=n triggers=n
STATISTICS=none file=/ogghome/oggexp/ogg.dmp log=/ogghome/oggexp/ogg.log tables=MM_PS.T_MCOUPONSINFO_HIS
6、将导出的数据导入到目标端数据库
imp mmdb03/*** file=/ogghome/oggexp/ogg.dmp log=/ogghome/oggexp/ogg.log full=y ignore=y buffer=64000000
7、目标端数据库禁掉新增表上的trigger与有级联删除的约束
select owner,table_name,TRIGGER_NAME from dba_triggers where table_name ='T_MCOUPONSINFO_HIS';
8、修改复制进程配置,增加复制表map关系,用filter指定复制scn
map MM_PS.T_MCOUPONSINFO_HIS, target MM_PS.T_MCOUPONSINFO_HIS, filter ( @getenv("TRANSACTION", "CSN") > 10930121916224);
9、启动进程
start r*
10、检查表数据同步情况
http://blog.itpub.net/24996904/viewspace-1226192/
OGG How to Resync Tables / Schemas on Different SCN s in a Single Replicat的更多相关文章
- 【故障处理】-OGG 丢失归档20190717
再次遇到OGG 异常: 归档丢失,OGG 不能找到需要的归档文件. 该表完整expdp 导出评估为 110G,了解到只有插入操作,所以只把归档丢失期间的数据补到目标端就好. 1. 清理目标端 2019 ...
- 3.使用OGG进程进行初始化数据
开始初始化数据的时候要满足下面的条件: 1.disable掉目标段表的外键约束 2.disable掉目标端表的触发器 3.删除目标段表的索引,加快初始化速度 4.目标端表结构创建完成 源端配置初始化抽 ...
- OGG 问题
1.启动复制时报 "ERROR OGG-15050 Oracle GoldenGate Delivery, l***.prm: Error loading Java VM runtime l ...
- 76 道 Oracle Goldengate 面试问题
基础 12c新特性 性能 Troubleshoot 其它 1. Oracle Goldengate 支持部署到哪些拓扑? GoldenGate supports the following topol ...
- 1Z0-050
QUESTION 13 View the Exhibit.Examine the following command that is executed for the TRANSPORT table ...
- Oracle11g中数据的倒库和入库操作以及高版本数据导入低版本数据可能引发的问题
文章版权由作者李晓晖和博客园共有,若转载请于明显处标明出处:http://www.cnblogs.com/naaoveGIS/. 1.前言 在10g之前,传统的导出和导入分别使用EXP工具和IMP工具 ...
- goldengate初始化
对丢弃已久的goldengate环境重新配置,使其重新开始跑起来 环境是一个主机上的两个库,都是单机,所以也就没配pump进程了,trail file都是在一个文件夹下的,extract写trail ...
- [转]oracle 10g数据泵之impdp-同时导入多个文件
要了解impdp,请先了解导出,我之前作过导出的笔记:oracle 10g数据泵之expdp.这两个笔记也许只对程序员有用,通常用于把正式区的数据导入到测试区,对数据库管理员也许帮助不大,他们使用这些 ...
- 【OCP、OCM、高可用等】小麦苗课堂网络班招生简章(从入门到专家)--课程大纲
[OCP.OCM.高可用等]小麦苗课堂网络班招生简章(从入门到专家)--课程大纲 小麦苗信息 我的个人信息 网名:小麦苗 QQ:646634621 QQ群:618766405 我的博客:http:// ...
随机推荐
- C# Excel批注“哪种开发语言最好”
Excel批注经常使用于为个别的单元格加入凝视.读者可以从凝视中获取额外的信息. 批注可隐藏,仅仅会在单元格右上方显示红色三角.加入后不会对单元格的内容喧宾夺主.在日常编程处理Excel中,为个别单元 ...
- js编程精解--笔记
看这本书的目的是为了更好的使用mongodb,所以只看js编程语言基础,不看浏览器和画布. 需要看1-11章,共160页 第一章 值.类型和运算符 第二章 程序结构 第三章 函数 第四章 数据结构:对 ...
- 实用API大全
有道翻译API http://fanyi.youdao.com/openapi 有道翻译API支持中英互译,同时获得有道翻译结果和有道词典结果(可能没有),返回格式为XML或JSON. 百度翻译A ...
- VS1053 datasheet 解读笔记
pdf 10 pdf 11 ` 左右声道 负载,注意这里的负载指LEFT 到GBUF,RIGHT到GBUF.所以后面会有说明GBUF一定不能连接到GND. pdf 14 pdf 14 从上面的引脚定 ...
- FAT和FAT32文件系统的原理
[转自] http://www.sjhf.net/Article/sjhfdoc/200404/1.html 一.硬盘的物理结构: 硬盘存储数据是根据电.磁转换原理实现的.硬盘由一个或几个表面 ...
- YTU 2424: C语言习题 字符串比较
2424: C语言习题 字符串比较 时间限制: 1 Sec 内存限制: 128 MB 提交: 1042 解决: 613 题目描述 写一函数,实现两个字符串的比较.即自己写一个strcmp函数,函数 ...
- vue开发购物车,解决全选单选问题
实现全选单选,在vue中无法通过this获取input中的checkbox的checked属性,但是可以通过vue对input的特殊方式v-model来实现对应数据的绑定,同样也可以通过这种方式实现购 ...
- javascript 树形菜单
1. [代码][JavaScript]代码 var ME={ini:{i:true,d:{},d1:{},h:0,h1:0,h2:0},html:function(da,f){var s='& ...
- ios蓝牙开发(四)BabyBluetooth蓝牙库介绍
BabyBluetooth 是一个最简单易用的蓝牙库,基于CoreBluetooth的封装,并兼容ios和mac osx. 特色: 基于原生CoreBluetooth框架封装的轻量级的开源库,可以帮你 ...
- apt-get update 问题 及gcc高亮
一 gcc高亮 gcc 高亮有好几种方法. 参考 http://www.cokco.cn/thread-39909-1-1.html 这个教程: (1) git clone https://githu ...