GoldenGate复制单表开并行
发表于:2024-09-24 作者:千家信息网编辑
千家信息网最后更新 2024年09月24日,最近有几项业务下线,需要从一张表中删除6.8亿多条数据。想办法把数据删除掉了,但对应的ogg灾备端复制时有了的延迟,而且延迟的时间起来越长。对于表太多造成的延迟可以把所有表分为多个组来做复制,于是想复
千家信息网最后更新 2024年09月24日GoldenGate复制单表开并行
最近有几项业务下线,需要从一张表中删除6.8亿多条数据。想办法把数据删除掉了,但对应的ogg灾备端复制时有了的延迟,而且延迟的时间起来越长。
对于表太多造成的延迟可以把所有表分为多个组来做复制,于是想复制进程是否可以对单表复制开并行。上网查到了相关的资料,可以使用@RANGE函数对单表作表内的拆分,通过对表上主键列作hash算法将该表上发生的变更均分到多个replicat上来降低单个replicat组件的负载。
动手实验一下:
ogg搭建过程不再重复,从网上就可以查到。
实验过程:模拟在源端对表scott.emp1做大量的dml操作,复制进程出现延迟,在目标端对复制表scott.emp1开并行3个进程。
源端插入数据:
SQL> insert into scott.emp1 select * from scott.emp;14 rows created.SQL> commit;Commit complete.SQL> insert into scott.emp1 select * from scott.emp1;14 rows created.SQL> /28 rows created.SQL> /.......SQL> /1835008 rows created.SQL> commit;Commit complete.SQL> select count(*) from scott.emp1; COUNT(*)---------- 3670016
目标端有延迟
GGSCI (rhel5) 15> info allProgram Status Group Lag Time Since ChkptMANAGER RUNNING REPLICAT RUNNING REPTAB 00:09:08 00:00:04
停掉复制进程
拆分复制进程,对表scott.emp1分三个进程复制
#源复制进程
GGSCI (rhel5) 23> view params reptabreplicat reptabSETENV (NLS_LANG="AMERICAN_AMERICA.ZHS16GBK")SETENV (ORACLE_SID="orcl")userid ogg,password 123456reperror default,discardassumetargetdefsdiscardfile /goldengate/dirrpt/reptab.dsc,append,megabytes 1024gettruncatesdynamicresolutionmap scott.emp1, target scott.emp1 ;map scott.emp, target scott.emp ;
源进程修改为
map scott.emp1, target scott.emp1 ,FILTER(@RANGE(1,3));多复制出两个参数文件:
GGSCI (rhel5) 1> view params reptab02replicat reptab02SETENV (NLS_LANG="AMERICAN_AMERICA.ZHS16GBK")SETENV (ORACLE_SID="orcl")userid ogg,password 123456reperror default,discardassumetargetdefsdiscardfile /goldengate/dirrpt/reptab.dsc,append,megabytes 1024gettruncatesdynamicresolutionmap scott.emp1, target scott.emp1 ,FILTER (@RANGE(2,3));GGSCI (rhel5) 2> view params reptab03replicat reptab03SETENV (NLS_LANG="AMERICAN_AMERICA.ZHS16GBK")SETENV (ORACLE_SID="orcl")userid ogg,password 123456reperror default,discardassumetargetdefsdiscardfile /goldengate/dirrpt/reptab.dsc,append,megabytes 1024gettruncatesdynamicresolutionmap scott.emp1, target scott.emp1 ,FILTER (@RANGE(3,3));
添加两个复制进程,extseqno和extrba与源进程一致
GGSCI (rhel5) 9> info reptabREPLICAT REPTAB Last Started 2017-05-05 16:18 Status ABENDEDCheckpoint Lag 00:09:08 (updated 00:09:38 ago)Log Read Checkpoint File ./dirdat/tl000003 2017-05-05 16:09:11.000187 RBA 194186157 GGSCI (rhel5) 10> add replicat reptab02, exttrail ./dirdat/tl,extseqno 3 extrba 194186157,checkpointtable ogg.checkpointREPLICAT added.GGSCI (rhel5) 11> add replicat reptab03, exttrail ./dirdat/tl,extseqno 3 extrba 194186157,checkpointtable ogg.checkpointREPLICAT added.
启动复制进程
GGSCI (rhel5) 12> start reptab*Sending START request to MANAGER ...REPLICAT REPTAB startingSending START request to MANAGER ...REPLICAT REPTAB02 startingSending START request to MANAGER ...REPLICAT REPTAB03 starting
查看数据库里ogg对应的会话
SQL> select module,sql_id from v$session where username='OGG';MODULE SQL_ID------------------------------------------------------------------------------------------------------------------------------------------------ ---------------------------------------OGG-REPTAB03-OPEN_DATA_SOURCE 1cxrusnmn01hzOGG-REPTAB-OPEN_DATA_SOURCE 1cxrusnmn01hzOGG-REPTAB02-OPEN_DATA_SOURCE 1cxrusnmn01hzSQL> select sql_text from v$sqlarea where sql_id='1cxrusnmn01hz';SQL_TEXT--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------INSERT INTO "SCOTT"."EMP1" ("EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO") VALUES (:a0,:a1,:a2,:a3,:a4,:a5,:a6,:a7)
可以看到出现了三个会话,都是对应的对表scott.emp1的插入语句。也就是说实现了对scott.emp1表的并行复制。
MOS上也有相关的文档介绍相应的功能,文档:1320133.1和1512633.1
参考:blog.itpub.net/15187685/viewspace-1219731/
进程
延迟
数据
三个
两个
多个
文档
目标
过程
实验
一致
下线
业务
也就是
也就是说
函数
办法
功能
单个
参数
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
数据库行级锁讲解
服务器如何对外开端口
服务器的管理员密码怎么设置
手机版云服务器怎么下载
电力公司网络安全部门
vb数据库表的查询
网络安全法6个月日志
pcs7服务器数据
打电话总显示服务器错误
我的世界多人服务器怎么弄东西
综合网络技术服务质量保障
开展网络安全管理业务培训
漫威超级战争服务器都是瓦坎达吗
什么是软件开发需求
微信砍价软件开发
计算机网络技术三级考试要上机吗
吴中区便宜服务器优质推荐
特殊时期网络安全怎么做好
华为终端服务器正常使用状态
钉钉网络安全
服务器st
vc网络连接数据库
地区级联数据库
职业高中计算机网络技术
服务器结构设计注意哪些问题
合并去重复的数据库
服务器电源接线端子用什么铜鼻子
服务器不认识U盘的两个盘符
宁波java软件开发工程师
软件开发能否转型产品经理