imp导入数据到ORACLE遇到ORA-12899错误

0x00原因

因为exp时字符集占用的位数比导入时字符集的占用的位数要少

0x01解决方案

这里演示的是ZHS16GBK为导出库字符集 而UTF-8为导入库 而作出的更改

:$sqlplus /nolog
SQL>conn / as sysdba
SQL>SHUTDOWN IMMEDIATE
SQL>STARTUP MOUNT
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 ZHS16GBK ;
ALTER DATABASE CHARACTER SET ZHS16GBK
*ERROR at line 1:
ORA-12712: new character set must be a superset of old character set
报字符集不兼容,此时下INTERNAL_USE指令不对字符集超集进行检查:
SQL>ALTER DATABASE CHARACTER SET INTERNAL_USE ZHS16GBK;
SQL>SHUTDOWN IMMEDIATE
SQL>STARTUP

再次用imp导入,就没有问题了。

导入了以后 NLS_LANG也要跟着改 不然乱码

export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS32GB18030"

0x02参考链接

http://blog.sina.com.cn/s/blog_713043600100ohva.html

http://blog.csdn.net/namesliu/article/details/8030316

Comments