这两天在Oracle导入一个比较大的表时,经常会遇到以下错误:

1
2
3
4
5
6
7
8
9
Export file created by EXPORT:V11.02.00 via conventional path
import done in AL32UTF8 character set and AL16UTF16 NCHAR character set
export client uses ZHS16GBK character set (possible charset conversion)
. importing TMGPSHIS's objects into TMGPSHIS
. importing TMGPSHIS's objects into TMGPSHIS
. . importing partition "TM_BUS_SITE_HIS":"P_SITE201904_B"
IMP-00009: abnormal end of export file
IMP-00028: partial import of previous table rolled back: 5209953 rows rolled back
Import terminated successfully with warnings.

其中IMP-00009IMP-00028这两个错误分别表示为:

  • IMP-00009: 导出文件异常结束
  • IMP-00028: 上一个表的部分导入已回退: 回退 5209953 行

连续测试好几次,包括在新机器上重新安装Oracle11G以及12C,均不能解决问题,最终浪费了一天的时间,后来机缘巧合下找到解决办法,在此一记。
在原来的导入命令:

1
imp username/password file=~/dmp_name.dmp tables=tablename ignore=y

中加入commit=yes参数,则表示导入成功的数据会被提交,但是这个操作似乎是有风险的,有可能会丢数据。(我没有测试,但是已解决我的问题)
此时,导入命令为:

1
imp username/password file=~/dmp_name.dmp tables=tablename ignore=yes buffer=300000000 comit=yes feedback=1000

最终得以解决问题。

参考解决方案:IMP-00009 abnormal end of export file