Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Summary of Chinese garbled problems in linux installation Oracle

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

To solve the problem of Chinese display garbled in oracle, there are three layers that need to be adjusted or modified.

Layer 1: operating system layer

1. First check whether linux has installed the Chinese character set

Locale-a

two。 Set the user's Chinese character set

If you see that linux has installed the Chinese character set, then oracle users need to set the Chinese character set next.

Vi / etc/locale.conf # centos7 is this configuration file, and some linux is this configuration file / etc/sysconfig/i18nLANG= "zh_CN.UTF-8"

After the above method is set, the character set of all users in the system is UTF-8. You can also change the user's character set, which is directly in .bashrc in the environment variable configuration file under the user.

Export LANG= "zh_CN.UTF-8"

Tier 2: database tier

Query the character set of the database and instance in the database

Select * from nls_database_parameters;select * from nls_instance_parameters

You can see that the character set of the database is ZHS16GBK,ok; to keep the character set of the server and the client consistent.

Export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

After this, then we open sqlplus query Chinese, generally can display, if it is still garbled, then the new insert a Chinese look, because the character code before the modification is inconsistent with the modified, for example, when inserted is UTF8 parsing, now changed to gbk then parsing is garbled. After sqlplus can display Chinese normally, we are one step closer to victory.

The third layer: plsql layer (windows layer)

Some people encounter that sqlplus can display Chinese normally, but the plsql query Chinese installed in their windows is garbled. (that's the problem. We need to unveil the Chinese garbled code.)

We have to understand, what is the cause of Chinese garbled code? It is caused by the inconsistency of the Chinese character set between the client and the server. It is easy to understand that two people speak the same language (character set). If you speak Cantonese and I speak Hokkienese, it must be very messy (garbled). Because parsing errors (server or client parsing errors).

So, the second layer is set in the environment variable.

Export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

That is, the character set of the client is consistent with the database. Well, our windows plsql is also a client, so we also need to set the environment variable NLS_LANG. Don't be wordy, above picture.

As long as it is ZHS16GBK, it doesn't matter whether the United States or China.

As in the above three layers, the problem of oracle garbled character set is basically solved, and this time, the character set in the oracle database in my example is ZHS16GBK, and some people set it to UTF8 when they install it, so the client has to be set to UTF8. And the character set of oracle database can be modified, this modification method can go to google.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report