oracle 中文乱码,解决但有疑问,希望看到的人给予解释。

前些日子安装了一个suse Linux下oracle数据库,近来连接到另外一台机器也是也是中文乱码。
oracle 中文乱码
于是查找字符集问题
SQL> select * from v$nls_parameters;--82(本机)
PARAMETER VALUE
---------------------------------------------------------------- ----------------------------------------------------------------82
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 ZHS16GBK
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
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

-------------------------------------
SQL> select * from v$nls_parameters;--43(服务器端)
PARAMETER VALUE
---------------------------------------------------------------- ----------------------------------------------------------------43
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 ZHS16GBK
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
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

一样的,很奇怪,找了些帖子 做以下操作
oracle@linux-t2hc:/u01/oracle/10g> export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
发现好了,从新窗口登陆
发现数据库登陆不了了,爆出以下错误
12705: invalid or unknown NLS parameter value specified
再做以下操作,登陆成功,乱码解决
oracle@linux-t2hc:/u01/oracle/10g> export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
SQL> connect aa/aa@gdms
Connected.
SQL> select * from houxt_tmp;

NQ NN
---------- --------------------
1 ??????

SQL> insert into houxt_tmp values(2,'你好');

1 row created.

SQL> commit;

Commit complete.

SQL> select * from houxt_tmp;

NQ NN
---------- --------------------
1 ??????
2 你好

[@more@]

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

转载于:http://blog.itpub.net/9307930/viewspace-1037048/

你可能感兴趣的:(oracle 中文乱码,解决但有疑问,希望看到的人给予解释。)