The following summarizes a large number of solutions to Oracle Chinese garbled characters. If you encounter such problems, refer to them.
The following summarizes a large number of solutions to Oracle Chinese garbled characters. If you encounter such problems, refer to them.
The following summarizes a large number of solutions to Oracle Chinese garbled characters. If you encounter such problems, refer to them.
AMERICAN_AMERICA.WE8ISO8859P1, this character encoding is the Western European character encoding, corresponding to. Net is the iso-8859-1 character encoding, so only need to change to the system's default character encoding on the line.
Solution:
(1) reinstall ORACLE on the server
When you reinstall ORACLE, select the same character set (in this example, US7ASCII) as the original unload data ).
Load the original detached data.
This situation only applies to empty databases and data with the same character set.
(2)
Write a function:
The Code is as follows: |
|
/**//// /// Encode the Western European characters into GB2312 /// /// /// Public static string Convert8859P1ToGB2312 (string s) { Return System. Text. Encoding. Default. GetString (System. Text. Encoding. GetEncoding ("iso-8859-1"). GetBytes (s )); } |
(3) Forcibly modify the current character set of ORACLE on the server
Before using the imp command to load data, log on to the system DBA using SQL * plus on the client and run the following SQL statement to modify the character set of the current ORACLE database:
The Code is as follows: |
|
SQL> create database character set US7ASCII * Create database character set US7ASCII ERROR at line 1: ORA-01031: insufficient privileges |
(3) display Chinese garbled characters
Oracle 10g has no Character Set set installed on Redhat. The default Operating System character set is used: WE8ISO8859P1, and the character set is changed to ZHS16GBK. Because the process is irreversible, you must first back up the database.
1. Full database backup
The Code is as follows: |
|
2. query the Current Character Set SQL> select * from nls_database_parameters where parameter = 'nls _ CHARACTERSET '; PARAMETER VALUE -------------------------------------------------------------------------------- NLS_CHARACTERSET WE8ISO8859P1 3. Shut down the database SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. 4. Start the database to the mount status. 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. Restrict session SQL> alter system enable restricted session; System altered. 6. query and modify relevant parameters 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 be a superset of old character set When an error occurs, the new character set must be a superset of the old character set. That is, the original character set is a subset of the new character set. You can query the character set inclusion relationship in the Oracle official documentation. The following uses the Oracle Internal Command internal_use to skip the superset check. This method is not recommended in the production environment. SQL> alter database character set internal_use ZHS16GBK; Database altered. 9. query the Current Character Set SQL> select * from nls_database_parameters where parameter = 'nls _ CHARACTERSET '; PARAMETER VALUE -------------------------------------------------------------------------------- NLS_CHARACTERSET ZHS16GBK 10. Shut down the database SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. 11. Start the database to the mount status. 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 parameters 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. |