异构数据库初始化大字段处理

联系:手机/微信(+86 17813235971) QQ(107644445)QQ咨询惜分飞

标题:异构数据库初始化大字段处理

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

一、source端

SOURCEISTABLE
SOURCEDB oracle
RMTHOST 127.0.0.1, MGRPORT 7820
RMTFILE D:\ogg\oracle\dirdat\i1
table dbo.t_v;
table dbo.t_t;

二、target端

SPECIALRUN
END RUNTIME
SETENV (NLS_LANG =AMERICAN_AMERICA.ZHS16GBK)  
userid ogg,password xifenfei   
EXTFILE D:\ogg\oracle\dirdat\i1
SOURCEDEFS D:\ogg\oracle\dirdef\t_v.def
discardfile D:\ogg\oracle\dirtmp\repsz.dsc,append,megabytes 100 
MAP "dbo.t_v", target mssql.t_v;
MAP "dbo.t_t", target mssql.t_t
, colmap ( id = id , text_t = @binary(t_text));

三、执行
extract paramfile dirprm\einit1.prm reportfile dirrpt\einit1.rpt
replicat paramfile dirprm\rinit1.prm reportfile dirrpt\rinit1.rpt

四、试验说明
如果大字段数据库过长,如这里的text字段类型过长是,在l1中有数据,但是target端的数据库中无对应数据,初步分析原因可能有:
1、defgen定义文件中确定文件长度导致
2、target端编码和clob列相关限制有关(可能性不大)
3、goldengate软件内在机制导致,还需要彻底的阅读官网文档
4、现在好像到target端的最终长度为4000byte(根据数据库编码不同区分汉字、字母、数字),在本测试中,如果source端使用ntext,target只能接收1000个汉字,如果是text类型,可以接受1333个汉字。
5、试验环境说明:sql server 2005 to oracle 11g,source端表(id int primary key auto,t_text text),target端(id number primary key,text_t clob)

—出现异常原因已经找到(2011年2月22日23:27:51)
When the size of a large object exceeds 4K, Oracle GoldenGate stores the data in segments within the Oracle GoldenGate trail. The first 4K is stored in the base segment, and the rest is stored in a series of 2K segments. Oracle GoldenGate does not support the filtering, column mapping, or manipulation of large objects of this size. Full Oracle GoldenGate functionality can be used for objects that are 4K or smaller.
大致意思就是当内容超过4k时,就不能使用过滤、列映射、或者操作大字段,当内容等于或者小于4k时,所有的goldengate函数都可以使用。上面问题是当t_text内容大于4k时,不能进行大对象操作。
疑问:那当有数据超过4k该怎么处理

—试验测试(2011年2月23日23:34:13)
初始化后,同步数据库过程中,异构数据库不同列类型(如:mssql中的text到oracle中的clob),也必须使用sourcedefs,使用适当的函数对列类型进行转换(如:colmap ( id = id , t_lob = @binary(t_lob))),对于大于4k的数据,还是和初始化一样不能被处理。该问题等待寻找解决方案

此条目发表在 GoldenGate 分类目录。将固定链接加入收藏夹。

异构数据库初始化大字段处理》有 2 条评论

  1. WWW_XYLOVE 说:

    “上面问题是当t_text内容大于4k时,不能进行大对象操作。”
    这个话是有问题的。
    goldengate 对大对象(LOB)有很好的支持,我同步过10M以下的BLOB大对象,像图片之类。replicat进程都能很好的复制。
    没有如何问题。

  2. equissono 说:

    非常相似。