ITPub博客

首页 > Linux操作系统 > Linux操作系统 > KUP-11008 ORA-12899 KUP-11009

KUP-11008 ORA-12899 KUP-11009

原创 Linux操作系统 作者:安佰胜 时间:2010-10-19 16:40:00 0 删除 编辑

KUP-11008: conversion error loading table "username"."table_name" partition " P1008260000 "

ORA-12899: value too large for column URL (actual: 260, maximum: 256)

KUP-11009: data for row: URL : 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'

 

 

1、测试不同字符集汉字占用字节数

impdp报上述错误,是从ZHS16GBK字符集导出的数据导入到AL32UTF8字符集中

10g中AL32UTF8字符集汉字占用3字节,而ZHS16GBK汉字是2字节

 

测试版本

SQL> select * from v$version;

 

BANNER

-----------------------------------------------------------------------------------------------------------

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

PL/SQL Release 11.2.0.1.0 - Production

CORE    11.2.0.1.0      Production

TNS for 32-bit Windows: Version 11.2.0.1.0 - Production

NLSRTL Version 11.2.0.1.0 - Production

 

SQL> set wrap off

SQL> set linesize 180

SQL> col name for a40

SQL> col value$ for a30

SQL> col comment$ for a40

 

SQL> select * from props$ where name='NLS_CHARACTERSET';

 

NAME                                     VALUE$                         COMMENT$

---------------------------------------- ------------------------------ -----------------------------------

NLS_CHARACTERSET                         AL32UTF8                       Character set

 

SQL> select name,lengthb(name) from an;

 

NAME                                     LENGTHB(NAME)

---------------------------------------- -------------

anbaisheng                                          10

安                                                   3

 

 

 

SQL> select * from props$ where name='NLS_CHARACTERSET';

 

NAME                                     VALUE$                         COMMENT$

---------------------------------------- ------------------------------ ----------------------------------------

NLS_CHARACTERSET                         ZHS16GBK                       Character set

 

SQL> select name,lengthb(name) from an.an;

 

NAME                                     LENGTHB(NAME)

---------------------------------------- -------------

anbaisheng                                          10

安                                                   2

 

 

=============

 

2、模拟错误

 

D:\>set oracle_sid=oratest

D:\>sqlplus an/an

SQL*Plus: Release 11.2.0.1.0 Production on 星期二 10月 19 16:13:45 2010

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

 

连接到:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SQL> delete from an where id=1;

已删除 1 行。

 

SQL> commit;

提交完成。

 

SQL> alter table an modify (name varchar2(2));

表已更改。

 

SQL> select * from an;

        ID NA

---------- --

         2 安

        

 

 

D:\>set oracle_sid=utf8

D:\>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期二 10月 19 16:15:16 2010

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

 

 

连接到:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SQL> create user an identified by an;

用户已创建。

 

SQL> grant dba to an;

授权成功。

 

SQL> exit

 

 

D:\>imp an/an file=1.dmp tables=(an)

Import: Release 11.2.0.1.0 - Production on 星期二 10月 19 16:17:01 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

 

连接到: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

经由常规路径由 EXPORT:V11.02.00 创建的导出文件

已经完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的导入

导入服务器使用 AL32UTF8 字符集 (可能的字符集转换)

. 正在将 AN 的对象导入到 AN

. 正在将 AN 的对象导入到 AN

. . 正在导入表                            "AN"

IMP-00019: 由于 ORACLE 错误 12899 而拒绝行

IMP-00003: 遇到 ORACLE 错误 12899

ORA-12899: 列 "AN"."AN"."NAME" 的值太大 (实际值: 3, 最大值: 2)

列 1 2

列 2 安导入了           0 行

成功终止导入, 但出现警告。

 

 

 

3、处理方法:

 

1、修改目标表字段长度,使其足够大能够容纳数据

D:\>sqlplus an/an

SQL*Plus: Release 11.2.0.1.0 Production on 星期二 10月 19 16:19:45 2010

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

 

连接到:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SQL> alter table an modify (name varchar2(3));

表已更改。

 

SQL> exit

 

D:\>imp an/an file=1.dmp tables=(an) ignore=y

Import: Release 11.2.0.1.0 - Production on 星期二 10月 19 16:20:57 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

 

连接到: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

经由常规路径由 EXPORT:V11.02.00 创建的导出文件

已经完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的导入

导入服务器使用 AL32UTF8 字符集 (可能的字符集转换)

. 正在将 AN 的对象导入到 AN

. 正在将 AN 的对象导入到 AN

. . 正在导入表                            "AN"导入了           1 行

成功终止导入, 没有出现警告。

 

 

SQL> select name,lengthb(name) from an.an;

NAME   LENGTHB(NAME)

------ -------------

安                 3

 

数据进入到数据库中

 

2设置INTERNAL_USE指令不对字符集超集进行检查

D:\>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期二 10月 19 16:23:24 2010

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

 

连接到:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SQL> SHUTDOWN IMMEDIATE

数据库已经关闭。

已经卸载数据库。

ORACLE 例程已经关闭。

SQL> STARTUP MOUNT

ORACLE 例程已经启动。

 

Total System Global Area  167387136 bytes

Fixed Size                  1373320 bytes

Variable Size             104860536 bytes

Database Buffers           54525952 bytes

Redo Buffers                6627328 bytes

数据库装载完毕。

 

SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;

系统已更改。

 

SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;

系统已更改。

 

SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0;

系统已更改。

 

SQL>  ALTER DATABASE OPEN;

数据库已更改。

 

SQL> ALTER DATABASE CHARACTER SET INTERNAL_USE ZHS16GBK;

数据库已更改。

 

SQL> exit

从 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options 断开

 

D:\>imp an/an file=1.dmp tables=(an)

 

Import: Release 11.2.0.1.0 - Production on 星期二 10月 19 16:25:49 2010

 

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

 

 

连接到: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

经由常规路径由 EXPORT:V11.02.00 创建的导出文件

已经完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的导入

. 正在将 AN 的对象导入到 AN

. 正在将 AN 的对象导入到 AN

. . 正在导入表                            "AN"导入了           1 行

成功终止导入, 没有出现警告。

 

D:\>sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on 星期二 10月 19 16:26:00 2010

 

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

 

 

连接到:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SQL> select instance_name from v$instance;

INSTANCE_NAME

----------------

utf8

 

SQL> select name,lengthb(name) from an.an;

 

NA LENGTHB(NAME)

-- -------------

安             2

 

数据进入,且长度仍然为2

        

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/13177610/viewspace-676289/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-08-26

  • 博文量
    215
  • 访问量
    660354