Character Set NLS_LANG

Source: Internet
Author: User
1. the NLS_LANG parameter is composed of the following parts: nls_lang?age_territory.clientscharactersetnls_lang each part has the following meanings: LANGUAGE specified: -Oracle message language-day in date month and day display TERRITORY specify-currency and digital-region and computing week and date habits CHARA

1. the NLS_LANG parameter is composed of the following parts: NLS_LANG = Language_Territory.Clients Characterset NLS_LANG each part has the following meanings: LANGUAGE specified: -Oracle message language-day in date month and day display TERRITORY specify-currency and digital-region and computing week and date habits CHARA

1. Composition of the NLS_LANG Parameter

The NLS_LANG parameter consists of the following parts:
NLS_LANG = _ .
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
Windows client settings, you can change NLS_LANG in the Registry, the specific key value is located in:
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;

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
========================================================== ========================================================== =

[Q] how to view database character sets
[A] database server Character Set select * from nls_database_parameters, which is derived from props $ and indicates the character set of the database.
  
Client Character Set environment select * from nls_instance_parameters, which is from v $ parameter,
  
Indicates the character set setting of the client, which may be a parameter file, environment variable, or registry.
  
Select * from nls_session_parameters in the session Character Set environment, which is derived from v $ nls_parameters, indicating the session's own settings, which may be the session environment variable or the session is completed by alter session. If the session has no special settings, it will be consistent with nls_instance_parameters.
  
The character set of the client must be the same as that of the server to correctly display non-Ascii characters of the database. If multiple settings exist, alter session> environment variable> registry> parameter file
  
The character set must be consistent, but the language settings can be different. We recommend that you use English for language settings. If the character set is zhs16gbk, The nls_lang can be American_America.zhs16gbk.
  
[Q] how to modify the character set
  
[A] version 8i and later can use alter database to modify the character set, but it is also limited to the subset to the superset. We do not recommend that you modify the props $ table, which may cause serious errors.
  
Startup nomount;
Alter database mount exclusive;
Alter system enable restricted session;
Alter system set job_queue_processes = 0;
Alter database open;
Alter database character set zhs16gbk;

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.