oracle更改编码

时间:2023-11-16 13:10:50

背景:win764bit英文操作系统(支持中文)

   oracle11G默认安装

   从ZHS16GBK字符集导入数据库

表现:plsql显示为乱码,所有汉字显示为“靠”

解决:1、查看并更改数据库的编码为ZHS16GBK

$sqlplus system/oracle

SQL> select * from v$nls_parameters;

PARAMETER                     VALUE

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

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            ZHS16GBK

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      UTF8

NLS_COMP                        BINARY

NLS_LENGTH_SEMANTICS         BYTE

NLS_NCHAR_CONV_EXCP          FALSE

如果 NLS_CHARACTERSET不是ZHS16GBK, 则需进行更改

$ sqlplus /nolog

SQL> connect sys/oracle as sysdba

SQL> startup

如何设置ORACLE数据库的编码(ZHS16GBK)修改成UTF8

SQL> shutdown immediate;

SQL> startup mount;

SQL> alter system enable restricted session;

SQL> alter system set job_queue_processes=0;

SQL> alter database open;

SQL> alter database character set internal_use ZHS16GBK;

SQL> shutdown immediate;

SQL> startup

另外

1.检查下regedit->HKEY_LOCAL_MACHINE->SOFTWARE->ORACLE->HOMEO
HKEY_LOCAL_MACHINE->SOFTWARE->ORACLE

NLS_LANG :SIMPLIFIED CHINESE_CHINA.ZHS16GBK

2、设置环境变量,NLS_LANG :SIMPLIFIED CHINESE_CHINA.ZHS16GBK

select *from ts_dict

Exception:ORA-29275: partial multibyte character

此异常是由于不同字符集导入数据时造成。1、重新导入;2、update table set field=trim(field)

REFERENCES:http://blog.csdn.net/lunzi028/article/details/4826982

http://www.cnblogs.com/XSHA/archive/2011/09/14/2176218.html