欢迎进入西安甲骨文培训机构 乘车路线| 关于我们| 设为首页| 加入收藏
logo 服务热线
1 2 3 3

新闻动态

联系我们

咨询报名电话:
029-85568080,029-85427081
传真:029-85568080
地址:陕西省西安市长安南路355号华银大厦(西北政法大学老校区对面西安银行南侧)

优秀学员

技术中心 当前位置:首页 > 新闻动态 > 技术中心

Oracle因安装时未设定字符集导致中文乱码的解决方案

点击: 时间:2013-12-30
在Centos6.5上安装Oracle11g没有设定字符集,采用的是操作系统默认字符集:WE8MSWIN1252,将字符集修改为:ZHS16GBK。

[oracle@xserver ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sat Dec 28 12:17:01 2013

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


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

SQL> select * from nls_database_parameters where parameter='NLS_CHARACTERSET';

PARAMETER
------------------------------
VALUE
--------------------------------------------------------------------------------
NLS_CHARACTERSET
WE8MSWIN1252

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 1056966768 bytes
Database Buffers 536870912 bytes
Redo Buffers 7360512 bytes
Database mounted.
SQL> alter system enable restricted session;

System altered.

SQL> show parameter job_queue_processes;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
job_queue_processes integer1000
SQL> alter system set job_queue_processes=0;

System altered.

SQL> alter database open;

Database altered.

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

SQL> alter database character set internal_use ZHS16GBK;

Database altered.

SQL> select * from nls_database_parameters where parameter='NLS_CHARACTERSET';

PARAMETER
------------------------------
VALUE
--------------------------------------------------------------------------------
NLS_CHARACTERSET
ZHS16GBK

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 1056966768 bytes
Database Buffers 536870912 bytes
Redo Buffers 7360512 bytes
Database mounted.
SQL> alter system set job_queue_processes=1000;

System altered.

SQL> alter database open;

Database altered.

SQL>