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

Resolve the problem that ORA-12705 cannot access NLS

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

An error was reported when connecting to the database through putty sql_plus:

ORA-12705:Cannot access NLS data files or invalid environment specified

This problem is mainly caused by the inconsistency between the current environment variable NLS_LANG setting of the system linux/windows after putty login and the database NLS_LANG parameter variable.

The NLS_LANG parameter consists of the following parts:

NLS_LANG= [Language] _ [Territory]. [Clients Characterset]

NLS_Language specifies:

The name of the language day and month of the Oracle (error) message

Note: NLS_LANGUAGE is independent of the language of the data being inserted and queried.

NLS_Territory specifies:

Range and practice for calculating the number of weeks and days in currency and number formats

Client character set (CLIENTS CHARACTERSET):

Define the Oracle client, the encoding used by the customer application, or it should match your Microsoft Windows code page (ACP of the GUI tool, CHCP value of the command prompt) or set to UTF8/AL32UTF8 for the Unicode WIN32 application.

1. First query the language character set environment variables of the database

SELECT (SELECT VALUE from nls_database_parameters WHERE parameter='NLS_LANGUAGE') | |'_'| | (SELECT VALUE from nls_database_parameters WHERE parameter='NLS_TERRITORY') | |'. | | (SELECT VALUE from nls_database_parameters WHERE parameter='NLS_CHARACTERSET') NLS_LANG FROM dual

Note:

Select userenv ('language') from dual;-- or select * from v$nls_parameters

The above query can only query the language character set of the current session of the database.

two。 Query in putty linux whether the current environment variable NLS_LANG is consistent with the database language character set.

Env | grep NLS_LANG

3. If it is inconsistent, use the export command to set the value of the linux environment variable NLS_LANG

Linux for example: export NLS_LANG=AMERICAN_AMERICA.AL32UTF8

If you want to permanently update this variable, you need to set or add the NLS_LANG in the .bash _ profile file

For example: vi ~ / .bash_profile

Note: if the remote machine is windows

There are three ways to set NLS_LANG by windows

The 1.cmd command is as follows:

Set nls_lang=AMERICAN_AMERICA.AL32UTF8

2.. Registry settings (permanent)

By default, the Oracle installation on windows uses the registry to define this setting.

Version 10g and above:

HKEY_LOCALMACHINE\ SOFTWARE\ ORACLE\ KEY

Here you will see an entry named NLS_LANG

Installing 32-bit software on a 64-bit windows platform uses a 32-bit compatibility path

HKEY_LOCALMACHINE\ SOFTWARE\ Wow6432Node\ ORACLE\ KEY

3.。 Operating system environment variable

Although the registry is the primary storage location for Microsoft Windows settings, it is not the only place where parameters can be set.

Although not recommended, you can set NLS_LANG to the system or user variable in the system properties. This setting will be used by all Oracle home.

Setting location:'my computer'- > 'Properties' > 'Advanced'-> 'Environment variable'

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