Solve oracle client garbled-SQLPLUS garbled

Source: Internet
Author: User

To solve the Oracle client garbled problem, the key is to unify the character set used by the server with the character set used by the client. The Oracle client (Sqlplus) uses the NLS_LANG environment variable to determine the character set used by the client. The NLS_LANG parameter consists of the following parts:
NLS_LANG = <Language >_< Territory>. <Clients Characterset>
The meanings of NLS_LANG are as follows:
LANGUAGE:
-Oracle message language
-Display month and day in date
Specified by TERRITORY
-Currency and Number Format
-Habits of regions and computing weeks and dates
CHARACTERSET:
-Control character sets used by Client Applications
Usually set or equal to the client (such as Windows) code page
Or set the unicode application to UTF8.
 
Run the chcp command to view the current system code page on Windows:
E: \> chcp
Active Code Page: 936
 
The code page 936 is also the Chinese Character Set GBK. on Microsoft's official site, we can be subject to specific encoding rules for the 936 code page. refer to the following link:
Http://www.microsoft.com/globaldev/reference/dbcs/936.htm
 
 
2. view the NLS_LANG Method
Windows:
 
Echo % NLS_LANG %
For example:
E: \> echo % NLS_LANG %
AMERICAN_AMERICA.ZHS16GBK
 
Unix usage:
 
Env | grep NLS_LANG
For example:
/Opt/oracle> env | grep NLS_LANG
NLS_LANG = AMERICAN_CHINA.ZHS16GBK
 
For Windows client settings such as PLSQL Developer, you can change NLS_LANG in the registry. The specific key value is located:
HKEY_LOCAL_MACHINE \ SOFTWARE \ ORACLE \ HOMExx \
Xx indicates the system number when multiple ORACLE_HOME exists.
 
 
3. view the current character set parameter settings of the database
SELECT * FROM v $ nls_parameters;
Or
Select * from nls_database_parameters
Or
Select userenv ('language') from dual;
 
4. view available Character Set parameter settings in the database
SELECT * FROM v $ nls_valid_values;
 
 
5. How to set the client NLS_LANG
Windows:
# Common Chinese character sets
Set NLS_LANG = SIMPLIFIED CHINESE_CHINA.ZHS16GBK
# Common unicode character sets
Set NLS_LANG = american_america.AL32UTF8
You can change the registry key value to set permanently.
HKEY_LOCAL_MACHINE \ SOFTWARE \ ORACLE \ HOMExx \ NLS_LANG
 
Unix:
# Common unicode character sets
Export NLS_LANG = american_america.AL32UTF8
# Common Chinese character sets
Export NLS_LANG = "Simplified Chinese_china". ZHS16GBK
You can edit the bash_profile file for permanent settings.
Vi. bash_profile
NLS_LANG = "Simplified Chinese_china". ZHS16GBK export NLS_LANG
# Make the bash_profile settings take effect
Source. bash_profile
 
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.