Home > Database > Mysql Tutorial > Oracle 字符集错误情况处理简单方法

Oracle 字符集错误情况处理简单方法

WBOY
Release: 2016-06-07 17:15:34
Original
1007 people have browsed it

Oracle 字符集错误情况处理简单方法,情况二、数据库中查询时,汉字显示乱码如果出现上面两种情况,那么先到数据库中查询数据库的

情况一:
[Oracle@ ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Tue Jun 26 20:52:47 2012
Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01157: ????/?????? 4 - ??? DBWR ????
ORA-01110: ???? 4: '+DGASM/ora11/datafile/users.261.785186921'

SQL> exit
英语显示?????
情况二、数据库中查询时,汉字显示乱码
如果出现上面两种情况,那么先到数据库中查询数据库的字符集
SQL> select * from nls_database_parameters where parameter in ('NLS_CHARACTERSET','NLS_NCHAR_CHARACTERSET');
PARAMETER            VALUE
-------------------- --------------------------------------------------
NLS_CHARACTERSET     ZHS16GBK
NLS_NCHAR_CHARACTERS AL16UTF16
ET
可以看到,当前数据库的字符集为ZHS16GBK, 国家字符集为AL16UTF16;
然后修改用户环境变量中的定义的字符集和数据库字符集保持一致
在 .bash_profile 中加入下面的变量即可
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

linux

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template