日期:2014-05-16  浏览次数:20489 次

Oracle10g字符集问题
从oracle9i中导出的数据导入到oracle10g中,经过程序的调用后,发现都是乱码,

开始以为是RHEL5系统字符集的事情,修改了几次后,发觉还是数据库的字符集有问题。

以下是用dba进入后查看的实际情况:

select * from V$NLS_PARAMETERS ;
NLS_LANGUAGE SIMPLIFIED CHINESE
NLS_TERRITORY CHINA
NLS_CURRENCY RMB
NLS_ISO_CURRENCY CHINA
NLS_NUMERIC_CHARACTERS .,
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE SIMPLIFIED CHINESE
NLS_CHARACTERSET WE8ISO8859P1
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY RMB
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE

select userenv('language') from dual;

显示字符集:

SIMPLIFIED CHINESE_CHINA.WE8ISO8859P1


select * from sys.props$ WHERE NAME='NLS_CHARACTERSET';

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

参考了网上的几个解决方法,都没有解决,最后还是使用了这样的方法解决了问题:

sqlplus "/as sydba"

shutdown immediate


Startup restrict

ALTER DATABASE CHARACTER SET ZHS16GBK;

有时候会遇到如下错误:

ORA-12712: new character set must be a superset of old character set

可以执行如下:跳过超集的检查

ALTER DATABASE character set INTERNAL_USE ZHS16GBK;

然后重启数据库即可,不过最好先做备份哦!