From the database to guide a data when there is a very strange problem, Chinese garbled. First of all, it can be confirmed that the data in the database is in Chinese, there is the use of toad to connect the query is also Chinese. But after the server side directly with the Sqlplus connection query, all Chinese are displayed as garbled. The first reaction is the character set problem, also try to use the change character set to solve the problem, the final problem is in the system environment variables.
Workaround:
1. Export parameters
$ Export Nls_lang=simplified CHINESE_CHINA.ZHS16GBK
2. Modify the configuration singular
Modify. Parameters in Bash_profile, adding related information
Nls_lang=simplified CHINESE_CHINA.ZHS16GBK;
Export Nls_lang;
The above is on the Linux platform, Windows platform with
C nls_lang=simplified CHINESE_CHINA.ZHS16GBK
Or add an environment variable to it.
3. Add a little knowledge:
Nls_lang is the environment variable of Linux system;
Nls_language is the parameter of the database.
We can modify the Nls_language in the session and cannot modify the Nls_lang.
Example:
SQL ALTER session SET nls_language= ' Simplified Chinese '
SQL alter session set NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;
Alter session Set NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
ERROR at line 1
ORA-00922 Missing or invalid option
Oracle related Parameters We can view it through the following SQL statements:
SQL Col PARAMETER format A30
SQL Col VALUE format A30
SQL Select from V$nls_parameters;
PARAMETER VALUE
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/
------------------------------ ------------------------------
Nls_language Simplified Chinese
Nls_territory
Nls_currency¥
Nls_iso_currency
Nls_numeric_characters.,
Nls_calendar Gregorian
Nls_date_format YYYY-MM-DD Hh24miss
Nls_date_language American
Nls_characterset ZHS16GBK
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 have been selected.