如何将数据从US7ASCII的库中导入到utf-8的库

[复制链接]
查看11 | 回复9 | 2014-1-17 10:00:29 | 显示全部楼层 |阅读模式
我用了http://www.itpub.net/showthread. ... 2011280#post2011280
这里面的方法。发现导入的是乱码。请问有什么办法吗?
是不是只能用sql loader了?
回复

使用道具 举报

千问 | 2014-1-17 10:00:29 | 显示全部楼层
数据库包含简繁韩和英文。
1) export NLS_LANG=AMERICAN_AMERICA.US7ASCII 导出(加了query,只导出中文)
2) 编辑到0354。(用hexedit编辑)
3) export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
4) 导入。发现乱码
回复

使用道具 举报

千问 | 2014-1-17 10:00:29 | 显示全部楼层
你把导出和导入的日志贴出来看看.
目标数据库是UTF-8么? 你怎么改成0354了?
回复

使用道具 举报

千问 | 2014-1-17 10:00:29 | 显示全部楼层
utf8应该是0367
参考:
http://www.eygle.com/special/NLS_CHARACTER_SET_05.htm
回复

使用道具 举报

千问 | 2014-1-17 10:00:29 | 显示全部楼层
eygle 谢谢
改成utf8可行吗?因为我从US7ASCII库了里导出的应该是GB的编码。我试过了
ZHS16CGB231280, UTF8, 都不行。
报错:
D:\impexp>imp parfile=eecol_imp.par
Import: Release 8.1.6.0.0 - Production on Tue Dec 7 11:16:08 2004
(c) Copyright 1999 Oracle Corporation.All rights reserved.

Connected to: Oracle9i Release 9.2.0.5.0 - Production
JServer Release 9.2.0.5.0 - Production
Export file created by EXPORT:V08.01.06 via conventional path
Warning: the objects were exported by WWW_EE, not by you
import done in ZHS16CGB231280 character set and UTF8 NCHAR character set
import server uses UTF8 character set (possible charset conversion)
IMP-00069: Could not convert to environment national character set's handle
IMP-00000: Import terminated unsuccessfully
回复

使用道具 举报

千问 | 2014-1-17 10:00:29 | 显示全部楼层
文件改到gb2312(352),NLS_LANG改到utf8。报错
D:\impexp>imp parfile=eecol_imp.par
Import: Release 8.1.6.0.0 - Production on Tue Dec 7 11:21:30 2004
(c) Copyright 1999 Oracle Corporation.All rights reserved.

Connected to: Oracle9i Release 9.2.0.5.0 - Production
JServer Release 9.2.0.5.0 - Production
IMP-00016: required character set conversion (type 850 to 871) not supported
IMP-00000: Import terminated unsuccessfully
回复

使用道具 举报

千问 | 2014-1-17 10:00:29 | 显示全部楼层
import done in ZHS16CGB231280 character set and UTF8 NCHAR character set
你改的有问题啊。
NLS_LANG怎么成了ZHS16CGB231280?
try:
1.exp with nls_lang = us7ascii
2.change dmp file header to 0367
3.imp with nls_lang = utf8
回复

使用道具 举报

千问 | 2014-1-17 10:00:29 | 显示全部楼层
我改过0367。出错。
D:\impexp>
D:\impexp>imp parfile=eecol_imp.par
Import: Release 8.1.6.0.0 - Production on Tue Dec 7 11:24:23 2004
(c) Copyright 1999 Oracle Corporation.All rights reserved.

Connected to: Oracle9i Release 9.2.0.5.0 - Production
JServer Release 9.2.0.5.0 - Production
Export file created by EXPORT:V08.01.06 via conventional path
Warning: the objects were exported by WWW_EE, not by you
import done in UTF8 character set and UTF8 NCHAR character set
IMP-00069: Could not convert to environment national character set's handle
IMP-00000: Import terminated unsuccessfully
D:\impexp>echo %NLS_LANG%
AMERICAN_AMERICA.UTF8
回复

使用道具 举报

千问 | 2014-1-17 10:00:29 | 显示全部楼层
这个错误可能和你的exp/imp版本有关,你可以用不同版本的exp/imp试试.
回复

使用道具 举报

千问 | 2014-1-17 10:00:29 | 显示全部楼层
我用过9.2带的,也用了8.1.6带的。都不行。我准备放弃了。我认为转不成功。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行