使用sys用户imp导入数据遇到字符集转换后列长度不够报错

使用sys用户imp数据遇到字符集转换时列长度不够的报错,ORA-12899: value too large for column "SYS"."M_ASH"."ACTION" (actual: 40, maximum: 32)。从报错可以看到具体的表、字段信息,报错SYS用户的M_ASH表的ACTION列,实际需要40byte,这里最大是32byte.原因是原来导出、导入过程的字符集转换。手动对表的列进行字段长度修改,重新使用DATA_ONLY=y参数导入即可。顺便记录一下使用sys用户imp/exp时需要转义,格式参考如下: imp \'sys/ as sysdba\' full=y DATA_ONLY=y file=m_ash_531.dmp imp \'sys/oracle as sysdba\' full=y DATA_ONLY=y file=m_ash_531.dmp

<span style="color:#000000">[<a data-cke-saved-href="/cdn-cgi/l/email-protection" href="/cdn-cgi/l/email-protection" class="__cf_email__">[email protected]</a> ~]$ imp \'sys/<a data-cke-saved-href="/cdn-cgi/l/email-protection" href="/cdn-cgi/l/email-protection" class="__cf_email__">[email protected]</a> as sysdba\' full=y file=m_ash_531.dmp
Import: Release 11.2.0.4.0 - Production on Mon Jun 5 10:34:50 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing option
Export file created by EXPORT:V10.02.01 via conventional path
Warning: the objects were exported by SYSTEM, not by you

import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
export server uses UTF8 NCHAR character set (possible ncharset conversion)
. importing SYSTEM's objects into SYS
. importing SYS's objects into SYS
. . importing table "M_ASH"
IMP-00019: row rejected due to ORACLE error 12899
IMP-00003: ORACLE error 12899 encountered
ORA-12899: value too large for column "SYS"."M_ASH"."ACTION" (actual: 40, maximum: 32)
Column 1 31633
Column 2 2183090312
………………
Column 47 23470 rows imported
Import terminated successfully with warnings.</span>

修改字段长度

$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jun 5 10:35:43 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options

SQL> truncate table M_ASH;

Table truncated.

SQL> desc M_ASH;
Name Null? Type
----------------------------------------- -------- ----------------------------
SNAP_ID NUMBER
DBID NUMBER
………………
MODULE VARCHAR2(48)
ACTION VARCHAR2(32)
CLIENT_ID VARCHAR2(64)
FLAGS NUMBER

SQL> alter table M_ASH modify ACTION VARCHAR2(42);

Table altered.

重新导入即正常:

]$ imp \'sys as sysdba\' full=y DATA_ONLY=y file=m_ash_531.dmp
Import: Release 11.2.0.4.0 - Production on Mon Jun 5 10:39:15 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing option
Export file created by EXPORT:V10.02.01 via conventional path
Warning: the objects were exported by SYSTEM, not by you

import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
export server uses UTF8 NCHAR character set (possible ncharset conversion)
. importing SYSTEM's objects into SYS
. . importing table "M_ASH" 23471 rows imported
Import terminated successfully without warnings.

SQL> select count(*) from M_ASH;
COUNT(*)
----------
23471
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值