Oracle Technology: The solution of sqlplus Chinese character garbled problem

Source: Internet
Author: User
Tags character set sqlplus linux

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.

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.