----1, cause analysis
----Through the analysis of the user's reflection, it is found that the improper setting of the character set is the key problem affecting the Chinese character display of Oracle database. So what about the character set? The character set is set by Oracle to fit the text display in different languages. The character set used for Chinese character display mainly has ZHS16CGB231280,US7ASCII,WE8ISO8859P1 and so on. Character sets need to be present not only on the server side, but also in the character set registration. On the server side, the character set is specified when Oracle is installed, and the character set registration information is stored in the v$ nls_parameters table of the Oracle database dictionary; The client, the character set is in two cases, one is the SQL*net version 2.0, The character set is registered in the Oracle.ini file in the system directory of Windows , and the other is Sql*net 2.0 (or 32-bit) version, which is registered in the Windows system registry. To correctly display the Oracle database kanji information on the client, you must first make the server-side character set consistent with the client's character set, followed by the data character set that is loaded into the Oracle database must match the server-specified character set. Therefore, the problem of user-induced classification, the emergence of Chinese characters display anomalies in the following ways:
----1. 1 server specifies that the character set is different from the customer character set and is consistent with the load data character set.
----This situation is the most common, as long as the client's character set is correct, the workaround is shown in 2.1.
----1. 2 server Specifies the same character set as the customer character set, inconsistent with the load data character set.
----This type of problem typically occurs when an Oracle version upgrade or reinstallation of the system selects a different character set than the original server side, while the restored loaded backup data is still unloaded from the original character set, and the load is unloaded from other Oracle databases that use different character sets. In both cases, the kanji cannot be displayed regardless of whether the server side and client character sets are consistent. The solution is shown in 2.2.
----1.3 server Specifies that the character set is different from the customer character set and is inconsistent with the input data character set.
----This is the case when the client and the server-side character set are inconsistent, the Chinese character information is entered from the client. This information entered does not display the Chinese character even if the client character set is changed correctly. The solution is shown in 2.3.
----2. Workaround
----The following will give a solution to each of the three scenarios listed below. For ease of narration, assume that the client is using a WINDOWS95/98 Environment and has successfully configured the TCP/IP protocol to install Oracle's Sql*net,sql*pluse product.
----2.1 Setting the client character set to match the server-side character set
----Assume that the current server side uses the US7ASCII character set.
----(1) View server-side character set
----Log on to a legitimate user of Oracle through a client or server-side Sql*plus, execute the following SQL statement:
SQL > select * from V$nls_parameters
Parameter value
Nls_language AMERICAN
Nls_territory AMERICA
.... ....
Nls_characterset Us7ascii
Nls_sort BINARY
Nls_nchar_characterset Us7ascii
----The character set for the server-side Oracle database is ' Us7ascii ', as shown in the list information above.
Oracle---Chinese garbled problem