一、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
四、實驗說明
更多精彩內容:http://www.bianceng.cn/database/Oracle/
如果大欄位資料庫過長,如這裡的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的資料,還是和初始化一樣不能被處理。該問題等待尋找解決方案
作者:51cto Oracle小混子