|
晚上十点多,准备睡觉了,以前的一个老客户找到我,说他们的库在imp的时候报错,需要技术支持
大概情况如下:
使用exp/imp升级并迁移数据库从win 10.2.0.1 升级到linux 11.2.0.3 由于硬盘空间不够,使用exp把win上面数据导出来,格式化掉win的数据文件所在硬盘格式化并加入到linux系统中(也就是说,故障之时,只有dmp文件,没有了数据文件)
imp报错如下:
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Tes
Export file created by EXPORT:V10.02.01 via conventional path
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
export client uses US7ASCII character set (possible charset conversion)
. . importing table "ART_T_ARCTYPE" 0 rows imported
. . importing table "ART_T_ARTICLE" 0 rows imported
……
. . importing table "EVT_T_ACCEPT_CODE" 1 rows imported
. . importing table "EVT_T_ACCEPT_FLOW"
illegal lob length marker 51166
bytesread = 00000000000
TABLE =EVT_T_ACCEPT_FLOW EVT_T_ACCEPT_FLOW
IMP-00098: INTERNAL ERROR: impgst2
IMP-00028: partial import of previous table rolled back: 680071 rows rolled back
IMP-00008: unrecognized statement in the export file:
???????????????????????????????????
IMP-00008: unrecognized statement in the export file:
.:
IMP-00008: unrecognized statement in the export file:
-$
IMP-00008: unrecognized statement in the export file:
6
IMP-00008: unrecognized statement in the export file:
IMP-00008: unrecognized statement in the export file:
.
IMP-00008: unrecognized statement in the export file:
/5
IMP-00008: unrecognized statement in the export file:
/5$
IMP-00008: unrecognized statement in the export file:
7%$
IMP-00008: unrecognized statement in the export file:
$;
IMP-00008: unrecognized statement in the export file:
$
…………
进一步分析exp导出日志
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses ZHS16GBK character set (possible charset conversion)
EXP-00091: Exporting questionable statistics.
. . exporting table EVT_T_ACCEPT_FLOW 3470071 rows exported
. . exporting table EVT_T_ACCEPT_FLOW1 2707606 rows exported
……
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully with warnings.
到这里基本上清楚了exp和imp的相关编码情况:
1. 原库编码是ZHS16GBK ,使用exp导出客户端编码为US7ASCII
2. 辛苦编码为ZHS16GBK ,使用imp导入客户端编码为ZHS16GBK
在导出过程中,因为ZHS16GBK 到US7ASCII 发生编码转换,甚至导致部分数据在dmp中可能无法完成编码转换(数据可能本身就有可能丢失),然后导入的时候客户端编码又是为ZHS16GBK(和数据库端编码一致,不再发生转换)
针对这样的情况,需要事先做一个是否有数据无法转换,而导致dmp文件本身就乱码的评估,使用dul文件扫描dmp,幸运的是数据都是正常(汉字为明显乱码),至此问题简单化:
处理方法:
就是在数据库的imp过程中也让其发生一个从US7ASCII 到ZHS16GBK 的编码转换,所以设置NLS_LANG=AMERICAN_AMERICA.US7ASCII,再执行imp即可解决问题.
|
|