1
2
|
sql代碼
select
*
from
v$nls_parameters
|
1
2
3
4
|
sql代碼
NLS_CHARACTERSET
SELECT
'AMERICAN_AMERICA.'
|| PROPERTY_VALUE
FROM
DATABASE_PROPERTIES
|
1
2
3
|
NLS_CHARACTERSET = AL32UTF8
NLS_LANG = AMERICAN_AMERICA.AL32UTF8
|
設置環境變量 重啓PLSQLhtml
NLS_LANG=AMERICAN_AMERICA.AL32UTF8linux
緣由:sql
客戶端與服務器端編碼不一致數組
瞭解下NLS_LANG的知識服務器
NLS_LANG 參數組成
NLS_LANG=<Language>_<Territory>.<Clients Characterset> session
查看Oracle服務端編碼:select * from sys.nls_database_parameters;oracle
從下面服務端 編碼咱們能夠獲得: NLS_LANG = AMERICAN_AMERICA.AL32UTF8post
查看oracle服務端編碼:select * from sys.nls_database_parameters;測試
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CHARACTERSET AL32UTF8
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
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_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_RDBMS_VERSION 11.2.0.1.0編碼
查看client編碼 :select * from sys.nls_session_parameters;
NLS_LANGUAGE SIMPLIFIED CHINESE
NLS_TERRITORY CHINA
NLS_CURRENCY ¥
NLS_ISO_CURRENCY CHINA
NLS_NUMERIC_CHARACTERS .,
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE SIMPLIFIED CHINESE
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_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
明顯客戶端的編碼和服務器端 的不一致!!!!解決辦法:
設置環境變量 重啓PLSQL
NLS_LANG=AMERICAN_AMERICA.AL32UTF8
此方法也適合用exp imp !以避免中文有亂碼出現!或部分數據亂碼!
WINNT> set NLS_LANG=AMERICAN_AMERICA.AL32UTF8
Linux> export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
查看 NLS_LANG 的方法
Windows使用:echo %NLS_LANG%
C:\Users\Administrator>echo %NLS_LANG%
AMERICAN_AMERICA.AL32UTF8
修改db編碼的辦法:(在oracle 11g上經過測試) --風險操做....最好不要用!!!!!!!!SQL> conn system as sysdba;SQL> shutdown immediate;SQL> startup mount;SQL> alter system enable restricted session;SQL> alter system set job_queue_processes=0;SQL> alter database open;SQL> alter database character set internal_use AL32UTF8;SQL> shutdown immediate;SQL> startup