Analysis of Oracle 8i Character Set garbled characters and Solutions

Source: Internet
Author: User

The Oracle tutorial is: Analysis of garbled characters in the Oracle 8i Character Set and solutions. I. Problem Description

SQL plus worksheet is an SQL statement editor for window graphic interfaces. This tool is very popular with SQL/plus for users who prefer Window Interfaces rather than character interfaces. However, after Oracle 8i, if the English character set is selected when Oracle 8i is installed, for China, the simplified Chinese character set (zhs16gbk) is usually selected. After the installation is successful, run SQL plus WorksheetProgram. All Chinese characters are displayed and the query results are garbled.

Ii. Problem Analysis

At first, the problem occurs. First, it is suspected that the character set is incorrect during installation, that is, the simplified Chinese character set is not correctly set. First, check the database character set. In SQL/plus, run the following SQL statement to check the character set of the connected database:

The query results show that the character set selected during database installation is zhs16gbk, which indicates that the character set is correctly set during installation. Step 2: Check the client registry and open the Registry Editor (Regedit). In HKEY_LOCAL_MACHINE/software/Oracle/nls_lang, the Oracle client character set is american_america.zhs16gbk, the setting is also completely correct, which can eliminate the problem of incorrect Character Set settings on the client. At the same time, the query character set in SQL/plus is displayed completely normal on the same client machine. This also shows that it is not a problem in Character Set setting, but a problem in the system program SQL/plus worksheet.

In versions earlier than Oracle 8i, this has never been the case. This should be related to the Oracle version, we know that a significant difference between Oracle 8i and earlier versions is that most of the Oracle system programs use Java drivers. In fact, this is the root cause of Character Set garbled characters. A non-Java-driven program, such as SQL * Plus, has a system parameter nls_lang. this parameter is set in the environment variable in the Unix system and in the Registry in the Windows operating system, this parameter determines the character set of the client application. For Java-based applications, such as SQL * Plus worksheet, The nls_lang parameter does not have any effect on such programs.

Iii. Solutions

After finding out the cause of the problem, we will discuss how to solve it. For all tools in Oracle Enterprise Manager, the configuration file name is dbappscfg. properties. You can modify the file to solve the above problem. The file is located in the $ ORACLE_HOME \ sysman \ config directory. open the file in any text editor and find this file,

Remove the annotator # and change it to sqlplus_nls_lang = american_america.zhs16gbk.

For Windows operating systems, you also need to modify one item. Find # sqlplus_systemroot = c: \ winnt40 in the file, remove the annotator, and change it to the operating system home directory of your machine. If the main directory of the operating system is in winnt of drive D, change it to sqlplus_systemroot = D: \ WINNT.

Modifications to the next item only apply to the Windows operating system, and are not required for the UNIX operating system. If this option is not modified in windows, the following error is prompted during system connection in Oracle Enterprise Manager:

Or

after modification, save the file and exit editing. Reconnect SQL plus worksheet to solve the character set garbled problem and display the correct simplified Chinese character set.

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.