Follow this procedure to set the NLS_LANG environment variable for Oracle databases.
To set the NLS_LANG environment variable for Oracle databases
Determine the NLS_LANG value.
In the data warehouse database, run the command
SELECT * FROM V$NLS_PARAMETERS
Make a note of the NLS_LANG value, which is in the format [NLS_LANGUAGE]_[NLS_TERRITORY].[NLS_CHARACTERSET].
For example: American_America.UTF8
For Windows:
Navigate to Control Panel > System and click the Advanced tab. Click Environment Variables.
In System variables section, click New.
In the Variable Name field, enter NLS_LANG.
In the Variable Value field, enter the NLS_LANG value that was returned in Step 1.
The format for the NLS_LANG value should be [NLS_LANGUAGE]_[NLS_TERRITORY].[NLS_CHARACTERSET].
For example: American_America.UTF8.
For UNIX, set the variable as shown below:
setenv NLS_LANG
For example: setenv NLS_LANG American_America.UTF8.
If your data is 7-bit or 8-bit ASCII and the Informatica Server is running on UNIX, then set
NLS_LANG _.WE8ISO8859P1
CAUTION: Make sure you set the NLS_LANG variable correctly, as stated in this procedure, or your data will not display correctly.
Reboot the machine after creating the variable.
May 3, 2021
I got ” ORA-12705: Cannot access NLS data files or invalid environment specified” error in Oracle database.
ORA-12705: Cannot access NLS data files or invalid environment specified
Details of error are as follows.
ORA-12705: "invalid or unknown NLS parameter value specified" Cause: There are two possible causes: - An attempt was made to issue an ALTER SESSION statement with an invalid NLS parameter or value. - The NLS_LANG environment variable contains an invalid language, territory, or character set. Action: Check the syntax of the ALTER SESSION command and the NLS parameter, correct the syntax and retry the statement, or specify correct values in the NLS_LANG environment variable.
invalid or unknown NLS parameter value specified
This ORA-12705 errors are related with two possible causes:
– An attempt was made to issue an ALTER SESSION statement with an invalid NLS parameter or value.
– The NLS_LANG environment variable contains an invalid language, territory, or character set.
Action: Check the syntax of the ALTER SESSION command and the NLS parameter, correct the syntax and retry the statement, or specify correct values in the NLS_LANG environment variable.
Firstly Unset the NLS_LANG environment variable,
Windows – The NLS_LANG must be unset in the Windows registry. Look for the NLS_LANG subkey in the registry at HKEY_LOCAL_MACHINESOFTWAREORACLE and rename it.
Linux/UNIX – Here you simply issue the Linux command “unset NLS_LANG”
You can set it as follows.
[MSDB]/home/oracle $ export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P9 [MSDB]/home/oracle $ [MSDB]/home/oracle $ echo $NLS_LANG AMERICAN_AMERICA.WE8ISO8859P9
And you can set the nls_date_language parameter as follows. ( you can set the value according to your language )
SQL> alter session set nls_date_language = 'AMERICAN'; Session altered. SQL> show parameter NLS_DATE_LANGUAGE NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ nls_date_language string AMERICAN SQL>
Do you want to learn Oracle Database for Beginners, then read the following articles.
Oracle Tutorial | Oracle Database Tutorials for Beginners ( Junior Oracle DBA )
1,214 views last month, 1 views today
I am getting this error while trying to create a connection pool, on my Oracle database, Oracle 10gR2.
java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1
ORA-12705: Cannot access NLS data files or invalid environment specified
I am able to connect to the database over sqlplus & iSQLPlus client, but when I try to connect using this Java program, I get this error just when the connection pool is to be initialised and it does not initialise the connection pool.
Can someone please help me resolving it?
DB Version: Oracle version 10.2.0.1
OS: RHEL 4.0
Here is a barebone, java code which is throwing this error, while connecting to my database.
import java.sql.*;
public class connect{
public static void main(String[] args) {
Connection con = null;
CallableStatement cstmt = null;
String url = "jdbc:oracle:thin:@hostname:1521:oracle";
String userName = "username";
String password = "password";
try
{
System.out.println("Registering Driver ...");
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
System.out.println("Creating Connection ...");
con = DriverManager.getConnection(url, userName, password);
System.out.println("Success!");
} catch(Exception ex) {
ex.printStackTrace(System.err);
} finally {
if(cstmt != null) try{cstmt.close();}catch(Exception _ex){}
if(con != null) try{con.close();}catch(Exception _ex){}
}
}
}
На днях я получил эту досадную ошибку оракула: ORA-12705: не удается получить доступ к файлам данных NLS или недействительной заданной среде. Забавно, что я не пытался получить доступ к файлам данных NLS
Ответ 1
Возможны две причины:
Была предпринята попытка выдать инструкцию ALTER SESSION с недопустимым параметром или значением NLS.
Переменная среды NLS_LANG содержит недопустимый язык, территорию или набор символов.
Fix:
Отменить переменную среды NLS_LANG
Windows. NLS_LANG должен быть удален в реестре Windows (лучше всего переименовать). Найдите подраздел NLS_LANG в реестре в HKEY_LOCAL_MACHINESOFTWAREORACLE и переименуйте его.
Linux/UNIX — здесь вы просто выдаете команду Linux «unset NLS_LANG»
Ответ 2
У меня есть Oracle 10g XE и Windows 7. Я решил это следующим образом:
Перейдите в Панель управления > Региональные и языковые параметры > Отформатируйте и установите язык.
Ответ 3
Следуйте этой процедуре, чтобы установить переменную среды NLS_LANG для баз данных Oracle.
Чтобы установить переменную среды NLS_LANG для баз данных Oracle
Определите значение NLS_LANG.
В базе данных хранилища данных выполните команду
SELECT * FROM V $NLS_PARAMETERS
Запишите значение NLS_LANG, которое находится в формате [NLS_LANGUAGE] _ [NLS_TERRITORY]. [NLS_CHARACTERSET].
Например: American_America.UTF8
Для Windows:
Перейдите в «Панель управления» > «Система» и перейдите на вкладку «Дополнительно». Выберите переменные среды.
В разделе «Системные переменные» нажмите «Создать».
В поле Имя переменной введите NLS_LANG.
В поле «Значение переменной» введите значение NLS_LANG, которое было возвращено на шаге 1.
Формат значения NLS_LANG должен быть [NLS_LANGUAGE] _ [NLS_TERRITORY]. [NLS_CHARACTERSET].
Например: American_America.UTF8.
Для UNIX установите переменную, как показано ниже:
setenv NLS_LANG
Например: setenv NLS_LANG American_America.UTF8.
Если ваши данные являются 7-битными или 8-разрядными ASCII, а Informatica Server запущен в UNIX, установите
NLS_LANG _.WE8ISO8859P1
ПРЕДУПРЕЖДЕНИЕ. Убедитесь, что вы правильно задали переменную NLS_LANG, как указано в этой процедуре, или ваши данные будут отображаться неправильно.
Перезагрузите компьютер после создания переменной.
Ответ 4
Вы также можете просто установить конфигурацию NLS в настройках оракула
Ответ 5
После добавления пути в переменную среды Oracle Instant client Oracle SQLPLUSW переходит к клиенту Oracle Instant, и для этого клиента требуется установить NLS LANG AS American_America.UTF8
Ответ 6
В моем случае я создавал адаптер базы данных в консоли web-браузера oracle, решая проблему, выполняя следующую конфигурацию.
Windows → панель управления → регион: 1. Измените формат на английский (США) формат даты M/d/yy и 2. Измените мой адрес в Соединенные Штаты. Выполните эту настройку, потому что моя машина была настроена на испанский язык, затем перезагрузите компьютер, и я работал без проблем.
Ответ 7
Если вышеприведенные решения не помогли, можете попробовать мое решение. Я только что заменил последнюю версию Ojdbc14.jar на более старую версию Ojdbc5.jar. Это помогло мне решить мою проблему.