您的位置:首页 > 数据库 > Oracle

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

2013-12-28 12:28 531 查看
在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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: