今天同事在导出的时候碰到了错误,EXP的过程中出现了ORA-3113和ORA-24324错误。
继续分析错误情况。
本来认为这个错误已经绕过去了,没想到的是,导入过程中又出现了错误:
$ imp system file=jg080424.dmp buffer=20480000 fromuser=shgov touser=jsgov_old ignore=y grants=n
Import: Release 9.2.0.4.0 - Production on星期四4月24 16:25:57 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Password:
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export file created by EXPORT:V09.02.00 via conventional path
Warning: the objects were exported by SHGOV, not by you
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
. importing SHGOV's objects into JSGOV_OLD
. . importing table "A" 0 rows imported
. . importing table "BYSS_FPAGE_DATA" 12 rows imported
. . importing table "CAT_BUYER" 7447 rows imported
. . importing table "CAT_DEALER" 14331 rows imported
. . importing table "CAT_ENTERPRISE" 23472 rows imported
. . importing table "CAT_GOVERNMENT" 452 rows imported
. . importing table "CAT_ORG" 31350 rows imported
. . importing table "CAT_PLAT_PRODUCT" 1369020 rows imported
. . importing table "CAT_PRODUCT" 90669 rows imported
. . importing table "HIS_INV" 0 rows imported
. . importing table "HIS_INV_INIT" 0 rows imported
. . importing table "HIS_OUT" 0 rows imported
.
.
.
. . importing table "SHGOV_HOS_CHARGE" 0 rows imported
. . importing table "SHGOV_MED_RETAILPRICE_DIFF" 134 rows imported
. . importing table "SHGOV_ORDER"
IMP-00058: ORACLE error 1438 encountered
ORA-01438: value larger than specified precision allows for this column
IMP-00028: partial import of previous table rolled back: 31322 rows rolled back
IMP-00009: abnormal end of export file
Import terminated successfully with warnings.
导入过程出现错误,而且错误就是出在导出时出现问题的表。不过这次错误信息已经足够明显了,表中出现了非法的数据导致数据的精度超过了列本身的限制,因此无法对该列执行导入操作。
Oracle在这里的隐含信息,甚至给出了错误的记录。由于出现了这个错误,导致了前面的31322条记录被回滚。这说明错误发生在表顺序读取时的第31323条。
通过SQLPLUS连接,访问第31323条记录,得到结果是部分字段超过长度限制,从而导致整条记录显示出现问题。
这条记录的存在是导入报错的原因,同时也是导出报错的原因。由于导出的时候处理超过长度限制的记录,所以才会报错ORA-600。而且由于后面使用了DIRECT方式导出,绕过了SQL引擎,Oracle不对数据是否满足字段限制条件进行检查,因此可以成功导出。但是导入的时候就没有办法绕过这条记录了。
对应的解决的方法其实很多,除了在目标数据库删除掉导致错误的异常数据外,还可以通过提前建立目标表,将字段的限制扩大,然后通过ignore=y的方式导入问题数据。