Oracle Chinese garbled Solution Summary

Source: Internet
Author: User
Tags character set create database oracle database

American_america. WE8ISO8859P1, this character encoding is a Western European character encoding, corresponding to the. NET is iso-8859-1 character encoding, so only need to change to the system's default character encoding on the line.

Workaround:

(1) server-side Reinstall Oracle

When you reinstall Oracle, select the character set that is consistent with the original data being unloaded (this example is Us7ascii).

Loads the original unloaded data.

This situation only applies to empty libraries and data that have the same character set.

(2)

Write a function:

The code is as follows Copy Code

/**////<summary>
Convert Western European character encoding to GB2312
</summary>
<param name= "S" ></param>
<returns></returns>
public static string convert8859p1togb2312 (string s)
{
Return System.Text.Encoding.Default.GetString (System.Text.Encoding.GetEncoding ("iso-8859-1"). GetBytes (s));
}

(3) Forcibly modifying the server-side Oracle current character set

Before loading data with the IMP command, first log on to the System DBA user with Sql*plus on the client and execute the following SQL statements for the current Oracle database character Set modification:

The code is as follows Copy Code

SQL > CREATE DATABASE Character Set Us7ascii
* CREATE DATABASE Character Set Us7ascii
ERROR at line 1:
Ora-01031:insufficient Privileges


(3) Display Chinese garbled

Oracle 10g is installed on Redhat with no set character set, operating system default character set: WE8ISO8859P1, modifying character set to: ZHS16GBK. Because the process is not reversible, you first need to back up the database.
1. Database fully prepared

The code is as follows Copy Code

2. Querying the current character set
Sql> SELECT * from nls_database_parameters where parameter= ' nls_characterset ';
PARAMETER VALUE
---------------------------------------- ----------------------------------------
Nls_characterset WE8ISO8859P1

3. Close the database
sql> shutdown Immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

4. Start database to Mount state

Sql> Startup Mount
ORACLE instance started.
Total System Global area 205520896 bytes
Fixed Size 1266608 bytes
Variable Size 100666448 bytes
Database buffers 100663296 bytes
Redo buffers 2924544 bytes
Database mounted.

5. Limit session

Sql> alter system enable restricted session;
System altered.

6. Query the relevant parameters and modify

Sql> Show parameter job_queue_processes;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
Job_queue_processes Integer 10

Sql> Show parameter aq_tm_processes;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
Aq_tm_processes integer 0

Sql> alter system set job_queue_processes=0;
System altered.

7. Open the Database

sql> ALTER DATABASE open;
Database altered.

8. Modify Character Set

Sql> ALTER DATABASE character set ZHS16GBK;
ALTER DATABASE character Set ZHS16GBK
*
ERROR at line 1:
Ora-12712:new Character set must is a superset of old character set

The error prompts that the new character set must be a superset of the old character set, and that the original character set is a subset of the new character set, which can then be queried for the character set inclusion relationship on the Oracle Official document. This method is not recommended in the production environment using the Oracle Internal command Internal_use to skip the superset check.

Sql> ALTER DATABASE character set Internal_use ZHS16GBK;
Database altered.

9. Querying the current character set
Sql> SELECT * from nls_database_parameters where parameter= ' nls_characterset ';
PARAMETER VALUE
---------------------------------------- ----------------------------------------
Nls_characterset ZHS16GBK

10. Close the database

sql> shutdown Immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

11. Start database to Mount state

Sql> Startup Mount
ORACLE instance started.
Total System Global area 205520896 bytes
Fixed Size 1266608 bytes
Variable Size 100666448 bytes
Database buffers 100663296 bytes
Redo buffers 2924544 bytes
Database mounted.

12. Change the relevant parameter back to the original value

Sql> alter system set job_queue_processes=10;
System altered.

13. Open the Database

Sql> ALTER DATABASE open;
Database altered.

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.