Home >Database >Oracle >What to do if the oracle database is garbled

What to do if the oracle database is garbled

藏色散人
藏色散人Original
2021-12-15 14:41:5216815browse

Oracle database garbled solution: 1. Log in to the database and execute the "select userenv('language') from dual;" statement; 2. Add the system environment variable "NLS_LANG" and match its value with the database encoding The settings remain consistent.

What to do if the oracle database is garbled

The operating environment of this article: Windows 7 system, Dell G3 computer, Oracle 11g version.

What should I do if the oracle database is garbled?

Solution to the problem of garbled data display in Oracle database

1. Problem description:

Importing data export files from other databases locally When creating a new database, the imported data is all garbled. Generally, the values ​​of the columns in the data table are similar to "?????", that is, most of the content is in the form of ?. The initial judgment is that the encoding of the Oracle client and the database are inconsistent. Garbled code problems are common in many places in various technologies, and the root cause is mainly caused by inconsistent data encoding. According to its principles, troubleshooting data encoding can basically solve the problem of garbled characters.

2. Solution:
Step 1: For Oracle database, you can use the sqlplus tool or PL/SQL tool. After logging in to the database, execute select userenv('language') from dual; statement, which can query the encoding format used by the current database. Here, use sqlplus to log in to the database and execute the above query statement, as shown in the following figure:

Step 2: Add the system environment variable NLS_LANG and keep its value with the database encoding setting Consistent, that is, the query result of the previous step is SIMPLIFIED CHINESE_CHINA.ZHS16GBK. Just click Save.

Step 3: Close the current client query tool, reopen it to check and verify whether the normal Chinese encoding has been restored.

Related recommendations: oracle database learning tutorial

The above is the detailed content of What to do if the oracle database is garbled. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to modify oracle portNext article:How to modify oracle port