ITPub博客

首页 > Linux操作系统 > Linux操作系统 > telnet AIX 中文乱码

telnet AIX 中文乱码

原创 Linux操作系统 作者:xz43 时间:2011-12-02 16:16:52 0 删除 编辑
本地windows系统,首先登录VPN,然后通过SSH连接到linux服务器,再用telnet登录AIX系统的Oracle数据库服务器。使用sqlplus命令连接数据库,输入和显示中文都是乱码。但使用系统命令 cat 和 more 查看包含中文的文件,中文却能正常显示。
 
查看数据库字符集
SQL> select * from v$nls_parameters;
PARAMETER                                                        VALUE
---------------------------------------------------------------- ----------------------------------------------------------------
NLS_LANGUAGE                                                     AMERICAN
NLS_TERRITORY                                                    AMERICA
NLS_CURRENCY                                                     $
NLS_ISO_CURRENCY                                                 AMERICA
NLS_NUMERIC_CHARACTERS                                           .,
NLS_CALENDAR                                                     GREGORIAN
NLS_DATE_FORMAT                                                  DD-MON-RR
NLS_DATE_LANGUAGE                                                AMERICAN
NLS_CHARACTERSET                                                 AL32UTF8
NLS_SORT                                                         BINARY
NLS_TIME_FORMAT                                                  HH.MI.SSXFF AM
PARAMETER                                                        VALUE
---------------------------------------------------------------- ----------------------------------------------------------------
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                                                $
NLS_NCHAR_CHARACTERSET                                           AL16UTF16
NLS_COMP                                                         BINARY
NLS_LENGTH_SEMANTICS                                             BYTE
NLS_NCHAR_CONV_EXCP                                              FALSE
19 rows selected.
SQL>
SQL> select * from SYS.PROPS$;
NAME                           VALUE$                                   COMMENT$
------------------------------ ---------------------------------------- --------------------------------------------------
DICT.BASE                      2                                        dictionary base tables version #
DEFAULT_TEMP_TABLESPACE        TEMP                                     Name of default temporary tablespace
DEFAULT_PERMANENT_TABLESPACE   SYSTEM                                   Name of default permanent tablespace
DBTIMEZONE                     +08:00                                   DB time zone
DEFAULT_TBS_TYPE               SMALLFILE                                Default tablespace type
NLS_LANGUAGE                   AMERICAN                                 Language
NLS_TERRITORY                  AMERICA                                  Territory
NLS_CURRENCY                   $                                        Local currency
NLS_ISO_CURRENCY               AMERICA                                  ISO currency
NLS_NUMERIC_CHARACTERS         .,                                       Numeric characters
NLS_CHARACTERSET               AL32UTF8                                 Character set
NAME                           VALUE$                                   COMMENT$
------------------------------ ---------------------------------------- --------------------------------------------------
NLS_CALENDAR                   GREGORIAN                                Calendar system
NLS_DATE_FORMAT                DD-MON-RR                                Date format
NLS_DATE_LANGUAGE              AMERICAN                                 Date language
NLS_SORT                       BINARY                                   Linguistic definition
NLS_TIME_FORMAT                HH.MI.SSXFF AM                           Time format
NLS_TIMESTAMP_FORMAT           DD-MON-RR HH.MI.SSXFF AM                 Time stamp format
NLS_TIME_TZ_FORMAT             HH.MI.SSXFF AM TZR                       Time with timezone format
NLS_TIMESTAMP_TZ_FORMAT        DD-MON-RR HH.MI.SSXFF AM TZR             Timestamp with timezone format
NLS_DUAL_CURRENCY              $                                        Dual currency symbol
NLS_COMP                       BINARY                                   NLS comparison
NLS_LENGTH_SEMANTICS           BYTE                                     NLS length semantics
NAME                           VALUE$                                   COMMENT$
------------------------------ ---------------------------------------- --------------------------------------------------
NLS_NCHAR_CONV_EXCP            FALSE                                    NLS conversion exception
NLS_NCHAR_CHARACTERSET         AL16UTF16                                NCHAR Character set
NLS_RDBMS_VERSION              10.2.0.5.0                               RDBMS version for NLS parameters
GLOBAL_DB_NAME                 MOE                                      Global database name
EXPORT_VIEWS_VERSION           8                                        Export views revision #
WORKLOAD_CAPTURE_MODE                                                   CAPTURE implies workload capture is in progress
NO_USERID_VERIFIER_SALT        FA24F63CA895C9B7DA60C8AED997DFC1
29 rows selected.
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Data Mining and Real Application Testing options
 
通过 locale 命令查看下系统支持的语言
$ locale -a
C
POSIX
en_US.8859-15
en_US.ISO8859-1
en_US
$
 
通过 env 命令查看当前用户的语言变量
$ env
_=/usr/bin/env
TMPDIR=/tmp
LANG=en_US
LOGIN=oracle
PATH=/u01/app/oracle/product/10.2.0/db_1/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/oracle/bin:/usr/bin/X11:/sbin:.
ORACLE_BASE=/u01/app/oracle
LC__FASTMSG=true
CLASSPATH=/u01/app/oracle/product/10.2.0/db_1/JRE/lib:/u01/app/oracle/product/10.2.0/db_1/JRE/lib/rt.jar:/u01/app/oracle/product/10.2.0/db_1/jlib:/u01/app/oracle/product/10.2.0/db_1/rdbms/jlib
LOGNAME=oracle
TMP=/tmp
MAIL=/usr/spool/mail/oracle
ORA_DB=/u01/app/oracle/product/10.2.0/db_1/dbs
ORACLE_SID=moe
LOCPATH=/usr/lib/nls/loc
USER=oracle
AUTHSTATE=files
TNS_ADMIN=/u01/app/oracle/product/10.2.0/db_1/network/admin
SHELL=/usr/bin/ksh
ORACLE_TERM=vt100
ODMDIR=/etc/objrepos
ORA_NLS33=/u01/app/oracle/product/10.2.0/db_1/ocommon/nls/admin/data
HOME=/home/oracle
TERM=vt100
MAILMSG=[YOU HAVE NEW MAIL]
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
PWD=/home/oracle
TZ=BEIST-8BEIDT
A__z=! LOGNAME
NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat
LIBPATH=/u01/app/oracle/product/10.2.0/db_1/lib:/u01/app/oracle/product/10.2.0/db_1/ctx/lib
LD_LIBRARY_PATH=/u01/app/oracle/product/10.2.0/db_1/lib:/usr/lib
$
 
通过 date 查看时间判断系统为中文还是英文系统
$ date
Fri Dec  2 14:38:01 BEIST 2011
$
 
查看 profile 的变量设置
$ cat .profile

PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:.
export PATH
if [ -s "$MAIL" ]           # This is at Shell startup.  In normal
then echo "$MAILMSG"        # operation, the Shell checks
fi                          # periodically.

umask 022
export TMP=/tmp;                    
export TMPDIR=/tmp;                 
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE                                                                           
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME                                                          
ORACLE_SID=moe; export ORACLE_SID                                                                                            
ORACLE_TERM=vt100; export ORACLE_TERM                                                                                     
TNS_ADMIN=$ORACLE_HOME/network/admin;export TNS_ADMIN                                                                     
#NLS_LANG=american_america.zhs16gbk; export NLS_LANG                                                                       
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data; export ORA_NLS33                                                           
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib; export LD_LIBRARY_PATH                                                         
LIBPATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib ;export LIBPATH                                                             
ORA_DB=$ORACLE_HOME/dbs;export ORA_DB                                                                                     
CLASSPATH=$ORACLE_HOME/JRE/lib:$ORACLE_HOME/JRE/lib/rt.jar:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH    
PATH=$ORACLE_HOME/bin:$PATH; export PATH                                                                                  
NLS_LANG="Simplified chinese_china.utf8";export NLS_LANG
$
 
原来profile里面没有最后一行的
NLS_LANG="Simplified chinese_china.utf8";export NLS_LANG
后来加上这行,再使用第三方工具 putty 通过telnet方式连接到数据库,就可以正常显示和编辑中文了。看来还真是 telnet 工具的原因,引起的中文乱码了。
 
不知道是否有其他解决办法,而不使用putty工具。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9399028/viewspace-712633/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-11-16

  • 博文量
    407
  • 访问量
    1724022