Goldengate实验:源端目标端字符集不同

http://blog.163.com/myy10146@126/blog/static/11355718620134175728388/

Goldengate实验:源端目标端字符集不同  

2013-05-17 17:07:28|  分类: Goldengate|举报|字号 订阅

  下载LOFTER 我的照片书  |

1、Goldengate版本

Oracle GoldenGate Command Interpreter for Oracle 
Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100 
Linux, x64, 64bit (optimized), Oracle 10g on Oct? 4 2011 23:50:20

Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.

?

2、源端oracle版本

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production 
With the Partitioning, OLAP and Data Mining options

字符集:AL32UTF8

?

3、目标端oracle版本

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production 
With the Partitioning, OLAP and Data Mining options

字符集:ZHS16GBK

?

4、实验一:参数文件中NLS_LANG参数都与目标端字符集一致

Goldengate参数文件:

GGSCI (node1) 2> view param ext01

extract ext01 
SETENV (ORACLE_SID=ogg) 
SETENV (NLS_LANG = AMERICAN_AMERICA.ZHS16GBK
userid ogguser, password ogguser 
exttrail dirdat/ex 
table SCOTT.emp;

GGSCI (node1) 3> view param rep01

replicat rep01 
setenv (ORACLE_SID=orcl10g) 
SETENV (NLS_LANG = AMERICAN_AMERICA.ZHS16GBK
userid ogguser, password ogguser 
ASSUMETARGETDEFS 
map scott.emp, target scott.emp ;

?

源端:

update emp set ename='外国人都生活在燃料油载砖厂在被风雨剥蚀了往复博联硅矓阿弥陀佛' where empno=7900;

commit;

select * from emp;


?

目标端:

select * from emp;


结论:抽取进程和复制进程参数文件中的NLS_LANG变量都与目标端的字符集一致,同步发生乱码。

实验二:抽取进程和复制进程NLS_LANG与各自数据库字符集一致

Goldengate参数文件:

GGSCI (node1) 2> view param ext01

extract ext01 
SETENV (ORACLE_SID=ogg) 
SETENV (NLS_LANG = AMERICAN_AMERICA.AL32UTF8
userid ogguser, password ogguser 
exttrail dirdat/ex 
table SCOTT.emp;

GGSCI (node1) 3> view param rep01

replicat rep01 
setenv (ORACLE_SID=orcl10g) 
SETENV (NLS_LANG = AMERICAN_AMERICA.ZHS16GBK
userid ogguser, password ogguser 
ASSUMETARGETDEFS 
map scott.emp, target scott.emp ;

源端:

update emp set ename='外国人都生活在燃料油载砖厂在被风雨剥蚀了往复博联硅矓阿弥陀佛' where empno=7900;

commit;

select * from emp;


目标端:

select * from emp;


结论:抽取进程和复制进程参数文件中的NLS_LANG变量与各自数据库字符集一致,同步发生乱码。

实验三:抽取进程和复制进程NLS_LANG都与源端数据库字符集一致

Goldengate参数文件:

GGSCI (node1) 2> view param ext01

extract ext01 
SETENV (ORACLE_SID=ogg) 
SETENV (NLS_LANG = AMERICAN_AMERICA.AL32UTF8
userid ogguser, password ogguser 
exttrail dirdat/ex 
table SCOTT.emp;

GGSCI (node1) 3> view param rep01

replicat rep01 
setenv (ORACLE_SID=orcl10g) 
SETENV (NLS_LANG = AMERICAN_AMERICA.AL32UTF8
userid ogguser, password ogguser 
ASSUMETARGETDEFS 
map scott.emp, target scott.emp ;

源端:

update emp set ename='外国人都生活在燃料油载砖厂在被风雨剥蚀了往复博联硅矓阿弥陀佛' where empno=7900;

commit;

select * from emp;


目标端:

select * from emp;


结论:抽取进程和复制进程参数文件中的NLS_LANG变量与源端数据库字符集一致,同步正常,不乱码。

?

5、结论

本实验只针对源端字符集为AL32UTF8 与 目标端ZHS16GBK的情况,只有在抽取进程和复制进程参数文件中的NLS_LANG变量与源端数据库字符集一致,才不发生乱码。

?

参考:How is NLS_LANG Set When You Run GoldenGate On The Superset Character Sets Database? [ID 969551.1]

阅读(2124) |  评论(0)

你可能感兴趣的:(OGG)