Oracle 11g R2 RAC数据库中文乱码解决

1、解决数据库中文乱码:

更改字符集步骤(WE8ISO8859P1 --> ZHS16GBK) :

[oracle@rac121 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on 星期五 8月 31 10:56:55 2012

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

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

SQL> shutdown immediate --这儿是RAC,所以需要关闭所有节点
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 1.3462E+10 bytes
Fixed Size                  2241104 bytes
Variable Size            7281315248 bytes
Database Buffers         6174015488 bytes
Redo Buffers                4485120 bytes
Database mounted.

SQL> alter system enable restricted session;

System altered.

SQL> show parameter job_queue

NAME                              TYPE          VALUE
-----------------------     -----------  ----------
job_queue_processes         integer        1000
SQL> show parameter aq_tm

NAME                              TYPE          VALUE
-----------------------     -----------  ----------
aq_tm_processes              integer        10

SQL> alter system set job_queue_processes=0;

System altered.

SQL> alter system set aq_tm_processes=0;

System altered.

SQL> alter database open;

Database altered.

SQL> Alter DATABASE character set INTERNAL_USE ZHS16GBK;
Alter DATABASE character set INTERNAL_USE ZHS16GBK
*
ERROR at line 1:
ORA-12720: 操作要求数据库处于 EXCLUSIVE 模式下 --由于是RAC环境,所以要修改参数cluster_database

SQL> alter system set cluster_database=false scope=spfile;

System altered.

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

Total System Global Area 1.3462E+10 bytes
Fixed Size                  2241104 bytes
Variable Size            7281315248 bytes
Database Buffers         6174015488 bytes
Redo Buffers                4485120 bytes
Database mounted.
SQL> alter system enable restricted session;

System altered.

SQL> alter database open;

Database altered.

SQL> Alter DATABASE character set INTERNAL_USE ZHS16GBK;

Database altered.

SQL> select userenv('language') from dual;

USERENV('LANGUAGE')
----------------------------------------------------
SIMPLIFIED CHINESE_CHINA.ZHS16GBK

SQL> alter system set job_queue_processes=1000;

System altered.

SQL> alter system set aq_tm_processes=10;

System altered.

SQL> alter system set cluster_database=true scope=spfile;

System altered.

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


Total System Global Area 1.3462E+10 bytes
Fixed Size                  2241104 bytes
Variable Size            7281315248 bytes
Database Buffers         6174015488 bytes
Redo Buffers                4485120 bytes
Database mounted.
Database opened.
SQL> show parameter cluster_database

NAME                                    TYPE                   VALUE
-----------------                    -------------        ------------------
cluster_database                     boolean                TRUE
cluster_database_instances       integer                 2
SQL> --到此可以向数据库中插入中文



2、SQLPLUS中文乱码:

[oracle@rac122 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Fri Aug 31 11:20:21 2012

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

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

SQL> select * from terry.t2;

VNAME
--------------------
??
?????

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
[oracle@rac122 ~]$ export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
[oracle@rac122 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on 星期五 8月 31 11:20:55 2012

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

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

SQL> select * from terry.t2;

VNAME
--------------------
呵呵
一二三国四

SQL> 





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值