Check the server/client encoding and modify the database encoding at Oracle 11g.

Source: Internet
Author: User

If the encoding of the Oracle server and client is inconsistent, Asp.net may display garbled characters when reading the database records.

View Oracle server code: Select * From SYS. nls_database_parameters; view client code: Select * From SYS. nls_session_parameters; if the two-end code is inconsistent, modify the client code:

Regedit open the registry:

HKEY_LOCAL_MACHINE/software/Oracle/key_oradb10g_home1

Modify the value of nls_lang, which is generally simplified chinese_china.zhs16gbk (Simplified Chinese encoding, which is also the default encoding when oracle is installed). If the server is utf8, the value must be changed to simplified chinese_china.al32utf8.

TIPS:If you do not remember the string, you can also view it by running select userenv ('language') from dual; on the server side.

 

In addition, if PL/SQL devloper is used, when the software is started, the encoding difference between the client and the server is also detected. If the difference is found, the following dialog box is displayed:

To remove this prompt, modify the handler for nls_lang in HKEY_LOCAL_MACHINE \ SOFTWARE \ wow6432node \ oracle \ key_1_lient11g_client_x86.

(Note: According to my actual test, after modifying the registry, although this prompt box is no longer displayed, it may cause garbled characters in the sqlplus of oracle, therefore, it is recommended that you directly check don't show this message again when this window is displayed for the first time)

How to modify the database encoding: (pass the test on Oracle 11g)
SQL> conn system as sysdba;
SQL> shutdown immediate;
SQL> startup Mount;
SQL> alter system enable restricted session;
SQL> alter system set job_queue_processes = 0;
SQL> alter database open;
SQL> alter database character set internal_use al32utf8;
SQL> shutdown immediate;
SQL> startup

Finally, record several common Oracle SQL commands: Unlock the user (HR): Alter user HR account unlock; change the user (HR) password (new password is HR ): alter user HR identified by HR; grant the select permission for the (EMP) Table to the user (HR): grant select on EMP to HR; Revoke authorization: Remove select on EMP from HR;
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.