IMP-00020的解决过程

今天给一台测试机导数据,导完后应用在连接的时候报了如下错误:
SQL state [null]; error code [17401]; 违反协议; nested exception is java.sql.SQLException: 违反协议
但是这个错只在访问某个表的时候报,而访问其他表的时候正常,这个表的结构如下:
SQL> desc tabname                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ADMIN_NAME                                NOT NULL VARCHAR2(40)
 ADMIN_PASS                                         VARCHAR2(40)
 ADMIN_PASS_CYCLE                                   NUMBER(5)
 ADMIN_PASSMARK                                     VARCHAR2(1000)
 ADMIN_DEPART                                       VARCHAR2(40)
 ADMIN_ROLE                                         VARCHAR2(40)
 ADMIN_EMAIL                                        VARCHAR2(100)
 ADMIN_PHONE                                        VARCHAR2(100)
 ADMIN_DESC                                         VARCHAR2(1000)
 ADMIN_CTIME                                        TIMESTAMP(6)
 ADMIN_UTIME                                        TIMESTAMP(6)
 ADMIN_NAME_CN                                      VARCHAR2(40)
 
怀疑此表有问题,单独exp/imp重新导入,imp时候出现如下错误:
. importing SCOTT's objects into HUGO
. . importing table                       "TABNAME"
IMP-00020: long column too large for column buffer size (7)
Import terminated successfully with warnings.
数据并没人导入,只导入表结构,网上查了半天,有人建议imp导入时候buffer大一些,试了没有用;有有人建议用测试机的客户端exp再imp,试了也没有用。后来在metalink查找,发现这可能是一个bug,bug号 2417643 是由于通过dblink采用CTAS方式导入含有timestamp类型的表而引起精度丢失而至,仔细回想一下,原表的确是通过CTAS方式导入的,比较imp后的表结构:
SQL> desc tbname
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ADMIN_NAME                                NOT NULL VARCHAR2(40)
 ADMIN_PASS                                         VARCHAR2(40)
 ADMIN_PASS_CYCLE                                   NUMBER(5)
 ADMIN_PASSMARK                                     VARCHAR2(1000)
 ADMIN_DEPART                                       VARCHAR2(40)
 ADMIN_ROLE                                         VARCHAR2(40)
 ADMIN_EMAIL                                        VARCHAR2(100)
 ADMIN_PHONE                                        VARCHAR2(100)
 ADMIN_DESC                                         VARCHAR2(1000)
 ADMIN_CTIME                                        TIMESTAMP(0)
 ADMIN_UTIME                                        TIMESTAMP(0)
 ADMIN_NAME_CN                                      VARCHAR2(40)
 
果然,timestamp中的精度从6变成了0,丢失了精度,提示IMP-00020。
找到了原因,解决办法就很简单了,手工将timestamp精度修改为6即可:
SQL> alter table tbname modify ADMIN_CTIME timestamp(6);
Table altered.
SQL> c /ctime/utime
  1* alter table tbname modify ADMIN_utime timestamp(6)
SQL> /
Table altered.
再次imp,数据导入正常,前台访问随之正常。

你可能感兴趣的:(职场,过程,解决,休闲,IMP-00020)