Could anyone advice please, what could be the cause of such problem:
After each restart of Oracle SQL developer NLS_LANGUAGE settings are being reset each time.
For example, when just opening a new session, NLS_LANGUAGE is set to LATVIAN and each time when starting SQL Dev, we need to run "alter session set NLS_LANGUAGE = 'AMERICAN'" to set it back to American.
Even that in Options -> NLS everywhere is set American.
We've checked all main lanaguage/location/region settings and set American everywhere, but still after re-launch only NLS_LANGUAGE setting is being reset, rest (like NLS_TERRITORY) are fine.
What hasn't been changed that triggers each time that reset?
You can change in Preferences. Search for NLS and change Language to AMERICAN
Related
My oracle have:
NLS_DATE_FORMAT DD/MM/RR
NLS_DATE_LANGUAGE SPANISH
and i execute
alter session set nls_date_format = 'DD-MON-RR';
alter session set NLS_DATE_LANGUAGE = 'AMERICAN';
alter system set nls_date_format='DD-MON-RR'
And everything is correct, but when i reset sql developer change to
LS_DATE_FORMAT=DD/MM/RR other one
How can I change it forever?
Your session settings might have been overwritten by SQL Developer when it relaunches.
To permanently fix it, Open SQL Developer and go to Tools -> Preference -> Database -> NLS and change Date Format to your required format there.
Alternatively, you could use an after logon trigger. That way you can set your settings independent of the client (SQL Developer) used.
I have an issue regarding configuring Thai language in oracle (PL/SQL Developer). I have configured Thai language 'AMERICAN_AMERICA.TH8TISASCII' in regedit. Also I configured Environment variables in my computer. But still when I connect PL/SQL developer and retrieve data, columns that should show Thai descriptions are showing garbage data. Please help me.
Example of garbage data is '¿¿¿¿¿¿¿¿'
Oracle Configurations is as below :
regedit->computer->HKEY_LOCAL_MACHINE->SOFTWARE->ORACLE->KEY_OraDB11g_home1
Windown Configuration is as below:
Mycomputer->Advanced system setting->Advanced System
Settings->Environment Variables -> (here i added variable)
the same configuration is done by my peers and they got the configuration but i am not able to do this
I have configured Thai language 'AMERICAN_AMERICA.TH8TISASCII' in regedit.
It means you have configured your NLS_LANGUAGE as AMERICAN and NLS_TERRITORY as AMERICA. Which is wrong.
You should select the following:
NLS_LANGAUGE=THAI
NLS_TERRITORY=THAILAND
You need to do this at:
Database level - init.ora file
Environment level - NLS LANG settings
I think your characterset is fine.
UPDATE OP got the issue with PL/SQL Developer tool.
You can enter "alter session" commands in the AfterConnect.sql file in the PL/SQL Developer installation directory. For example:
alter session set nls_date_format='dd-mm-yyyy';
alter session set nls_territory='THAILAND';
alter session set nls_language='THAI';
source
I assume your selected font in PL/SQL Developer does not support Thai characters. Try this command to check:
SELECT UNISTR('Kho Khuat: \0E03') FROM DUAL;
Do you get proper output like this?
Kho Khuat: ฃ
If not, you should select a font which support Thai characters.
You can use this page FileFormat.info to check which font supports your character.
Value for NLS_LANG should match your local environment settings, not the setting from Database. By this all characters are properly translated in SQL communication.
Check you local environment with this command:
c:\>reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage /v ACP
In my case it is
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage
ACP REG_SZ 1252
So, my NLS_LANG should be set to .WE8MSWIN1252 or something similar.
However, this is only valid if your application (SQL Developer in your case) uses the default encoding settings from Windows. In some applications you can change that - typically you can switch between local codepage and Unicode (UTF-8). In this case you must modify NLS_LANG accordingly.
Is it possible to alter the session permanently even after i close my oracle sql developer?
An example of the statement that i want to alter:
Alter Session Set Nls_Timestamp_Tz_Format='HH24:MI TZR';
The above statement only allow me to alter the current session and not making it permanently.
Thanks
If you just want to change the default value for SQL Developer, you can do that in the SQL Developer settings. In SQL Developer 3.1 (the same settings exist in earlier versions though the navigation may be slightly different), Tools | Preferences | Database | NLS allows you to specify a Timestamp Format and a Timestamp TZ Format. SQL Developer will then automatically issue the appropriate ALTER SESSION commands for you whenever it creates a new session.
You need to set this in the initialization parameter file to affect the database globally.
Initialization parameters such as Nls_Timestamp_Tz_Format can be set up from three sources:
In a session using the ALTER SESSION SET statement
In client side parameter file init.ora
In server side parameter file spfile
To set default permanently in the db, from the database:-
alter system ... scope=spfile;
then as SYS (so you may need to talk to a DBA), and obviously at an appropriate time! -
shutdown;
startup;
(I know the spfile has been mentioned, but it can all be done from the sqlplus cmdline, at least in 11g.)
We have created a "after logon" trigger to alter the session in order to set the two NLS settings - NLS_SORT and NLS_COMP. NLS_SORT needs to be set to BINARY_CI and NLS_COMP needs to be set to LINGUISTIC. By querying the V$NLS_PARAMETERS view after establishing the connection to verify the values I see that NLS_COMP parameter gets updated but NLS_SORT doesn't.
After researching more I realized that the OCI JDBC driver executes the below query after the connection is established
ALTER SESSION SET NLS_LANGUAGE='AMERICAN' NLS_TERRITORY='AMERICA'
Since NLS_SORT derives its values from NLS_LANGUAGE, NLS_SORT parameter value resets to BINARY instead of BINARY_CI. The NLS_LANGUAGE setting is taken from windows registry.
Does the oci jdbc driver execute these queries to synchronize the NLS settings on the client to that with the database server?
Can the jdbc oci driver be configured to avoid executing the alter session set NLS_LANGUAGE query?
The reason I ask the second question is that it doesn't make sense for application server (e.g glassfish, tomcat, jboss) machine (on which the OCI client is installed) settings to override the database server settings.
I have been wrestling with the exact same problem after introducing a trigger on logon for setting these values.
"The purpose of the NLS_LANGUAGE and NLS_TERRITORY settings are to let the database know locale information. These are derived from the NLS_LANG setting on the client (but can also be changed). These settings allow the database to send data back to the client in the expected format and language." - taken from here
No, it can't be configured to avoid that execution, though it might be a future feature. As it is, it seems the only solution is to have your application always change these parameters after logging in.
It might be of help to know that if you're using the thin connector rather than the OCI-driver and you set an on logon trigger, these values will be set properly after logon. The problem here is with the OCI-driver that will set up these values according to NLS_LANG only after the logon trigger has been executed.
According to chapter 19 Globalization Support from Home / Database / Oracle Database Online Documentation 12c Release 1 (12.1) / Application Development / Database JDBC Developer's Guide:
Starting from Oracle Database 10g, the NLS_LANG variable is no longer
part of the JDBC globalization mechanism. The JDBC driver does not
check NLS environment. So, setting it has no effect.
ALTER SESSION statement which you observed probably comes from the following statement from Globalization Support for JDBC Drivers section of chapter 9 Java Programming in a Global Environment from Oracle9i Database Globalization Support Guide (Release 2 (9.2)):
At database connection time, the JDBC Class Library sets the server
NLS_LANGUAGE and NLS_TERRITORY parameters to correspond to the locale
of the Java VM that runs the JDBC driver. This operation is performed
on the JDBC OCI and JDBC thin drivers only, and ensures that the
server and the Java client communicate in the same language.
The other day I got this annoying oracle error: ORA-12705: Cannot access NLS data files or invalid environment specified. Funny thing I wasn't trying to access NLS data files
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.
Fix:
Unset the NLS_LANG environment variable
Windows - The NLS_LANG must be unset in the Windows registry (re-named is best). Look for the NLS_LANG subkey in the registry at \HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE, and rename it.
Linux/UNIX - Here you simply issue the Linux command "unset NLS_LANG"
I have Oracle 10g XE and Windows 7. I resolved this as follows:
Go to Control panel > Regional and language options > Format and set your language.
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.
In my case, I was creating a database adapter in the oracle weblogic console, solve the problem by doing the following configuration.
Windows -> control panel -> region: 1. Change the format to English (United States) date format M / d / yy and 2. Change my address to the United States. Perform this configuration because my machine was configured with the Spanish language, then restart the computer and I worked without problems.
After addition of path in Environment variable of Oracle Instant client the Oracle SQLPLUSW goes to Oracle Instant client and for that client it required to set NLS LANG AS American_America.UTF8
You can also just set the NLS config in your oracle settings
In case if above solutions not helped, can try my solution. I just replaced my latest version of Ojdbc14.jar to an older version Ojdbc5.jar. It helped me to solve my issue.
I was trying to configure my Data Source on WebLogic 12c that was pointing to an 11g Database and I kept getting this error. I found out that WL 12c is not compatible with oracle 11g databases.
I know it is not related but I am sure someone else will find this useful.