oracle 中文亂碼,解決但有疑問,希望看到的人給予解釋。

generators發表於2010-08-19

前些日子安裝了一個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

一樣的,很奇怪,找了些帖子 做以下操作
> export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
發現好了,從新視窗登陸
發現資料庫登陸不了了,爆出以下錯誤
12705: invalid or unknown NLS parameter value specified
再做以下操作,登陸成功,亂碼解決
> export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
SQL> connect
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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章