Oracle classic garbled problem-rely on

Source: Internet
Author: User

Recently, when I was working on a project, I encountered a problem. During the select Operation on the Oracle 11g database of Windows 2003 system, the result was "dependent on ", at that time, the O & M personnel did not know much about oracle, So they found me. I checked the character set between the server and the client and found that the server is zhs16gbk and the client is american_america.we8iso8858p1, when I modified the character set of the client and the server, the problem was solved.

The following is a technical document I have prepared to explain how to learn oracle in the future.

Environment:

Windows 2003 32 system, Oracle 11g Database

1. Connect to oracle 11g for windows 2003

 
 
  1. C :\>Sqlplus/as sysdba
  2. SQL * Plus: Release 11.2.0.1.0 Production on Monday May 21 15:03:29 2012
  3. Copyright (c) 1982,201 0, Oracle. All rights reserved.
  4. Connect:
  5. Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-Production
  6. With the Partitioning, OLAP, Data Mining and Real Application Testing options
2. view the character set of the Client
 
 
  1. SQL> select userenv('language') from dual;  
  2.  
  3. USERENV('LANGUAGE')  
  4. ----------------------------------------------------  
  5. AMERICAN_AMERICA.ZHS16GBK  
3. view the server Character Set
 
 
  1. SQL> set linesize 100  
  2. SQL> col parameter for a40  
  3. SQL> col value for a40  
  4. SQL> select * from nls_database_parameters where parameter like '%CHARACTERSET%%';  
  5.  
  6. PARAMETER                VALUE  
  7. ---------------------------------------- ----------------------------------------  
  8. NLS_CHARACTERSET             ZHS16GBK  
  9. NLS_NCHAR_CHARACTERSET       AL16UTF16  
We can see that the character set of the client and server is consistent, both of which are ZHS16GBK. 4. Create a dl_char table
 
 
  1. SQL>Create table dl_char (name varchar2 (20 ));
  2.  
  3. The table has been created.
5. Insert data
 
 
  1. SQL>Insert into dl_char values ('character set garbled Ps ');
  2.  
  3. One row has been created.
6. select query
 
 
  1. SQL>Select * from dl_char;
  2.  
  3. NAME
  4. --------------------
  5. Character Set garbled
As you can see, it is displayed as the value I just entered 7. Change the character set of the client.
 
 
  1. C:\>SET NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1 
8. log on again.
 
 
  1. C:\>sqlplus / as sysdba  
  2.  
  3. SQL*Plus: Release 11.2.0.1.0 Production on Mon May 21 15:06:55 2012  
  4.  
  5. Copyright (c) 1982, 2010, Oracle.  All rights reserved.  
  6.  
  7.  
  8. Connected to:  
  9. Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production  
  10. With the Partitioning, OLAP, Data Mining and Real Application Testing options  
  • 1
  • 2
  • Next Page

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.