ORA-00604: error occurred at recursive SQL level 1
ORA-12705: Cannot access NLS data files or invalid environment specified
You might see this combination of error messages in a situation where an Oracle 12c listener is used to service an Oracle11G database, and static service registration is used in the listener (without specifying the NLS_ORA10 variable) while connection to the database using the NLS_LANG parameter.
DYNAMIC SERVICE REGISTRATION:
First we have a look when ‘dynamic registration is used’:
Local listener is specified in the database:
1 2 3 |
NAME TYPE VALUE ----------------- -------- ----------------------------------------------------------------- local_listener string (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=localhost)(Port=1530))) |
The service is automatically registered in the listener, as can be seen with the service command, I will only highlight a few variables here:
1 2 3 4 5 6 |
Service "tstdha04 " has 1 instance(s). Instance "tstdha04", status <strong>READY</strong>, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER (ADDRESS=(PROTOCOL=BEQ)(PROGRAM=/lfs/oracle/ora11204160719V4/bin/oracle)(ARGV0=oracletstdha04)(ARGS='(LOCAL=NO)')(ENVS='….ORACLE_BASE=/lfs/oracle,ORACLE_HOME=/lfs/oracle/ora11204160719V4,ORA_NLS10=/lfs/oracle/ora11204160719V4/nls/data')(ENV_POLICY=NONE)) |
The environment settings ORACLE_HOME and ORA_NLS10 are set correctly, we will not encounter any issues in this situation.
STATIC SERVICE REGISTRATION:
The local_listener parameter is unset to ensure no dynamic registration exists within the listener for the instance. Some additional required settings are added to the listener.ora to enable the static service registration:
1 2 3 4 5 6 7 8 9 10 11 12 |
(SID_DESC = (SID_NAME = tstdha04) (ORACLE_HOME = /lfs/oracle/ora11204160719V4) (ENVS='TZ=Australia/Victoria') ) Service "tstdha04" has 1 instance(s). Instance "tstdha04", status UNKNOWN, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 LOCAL SERVER (ADDRESS=(PROTOCOL=beq)(PROGRAM=/lfs/oracle/ora11204160719V4/bin/oracle)(ENVS='TZ=Australia/Victoria,ORACLE_HOME=/lfs/oracle/ora11204160719V4,ORACLE_SID=tstdha04')(ARGV0=oracletstdha04)(ARGS='(LOCAL=NO)')) |
Let’s run our test (we see the error especially when we specify the language ENGLISH in the NLS_LANG parameter):
Test 1:
Just try to connect using the client default settings, no issues:
1 2 3 4 5 |
C:\Users\qt89739>sqlplus /nolog SQL*Plus: Release 11.2.0.3.0 Production on Wed Oct 25 11:31:22 2017 Copyright (c) 1982, 2011, Oracle. All rights reserved. SQL> connect resource01/@"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=)(Port=)))(CONNECT_DATA=(SID=tstdha04)))" Connected. |
Test 2:
Try connect using when environment setting NLS_LANG=ENGLISH_AUSTRALIA is set
1 2 3 4 5 6 7 8 9 |
C:\Users\qt89739>set NLS_LANG=ENGLISH_AUSTRALIA C:\Users\qt89739>sqlplus /nolog SQL*Plus: Release 11.2.0.3.0 Production on Wed Oct 25 11:31:38 2017 Copyright (c) 1982, 2011, Oracle. All rights reserved. SQL> connect resource01/@"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=)(Port=)))(CONNECT_DATA=(SID=tstdha04)))" ERROR: ORA-00604: error occurred at recursive SQL level 1 ORA-12705: Cannot access NLS data files or invalid environment specified |
OOPS seems something is wrong. The ORA-00604 is pointing us to the database server something is wrong there… let’s see…
Of course, the static listener registration is incomplete, we miss the ORA_NLS10 environment setting, lets change it and reload the listener:
1 2 3 4 5 6 7 8 9 10 11 12 |
(SID_DESC = (SID_NAME = tstdha04) (ORACLE_HOME = /lfs/oracle/ora11204160719V4) (ENVS='TZ=Australia/Victoria,ORA_NLS10=/lfs/oracle/ora11204160719V4/nls/data') ) Service "tstdha04" has 1 instance(s). Instance "tstdha04", status UNKNOWN, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:1 refused:0 LOCAL SERVER (ADDRESS=(PROTOCOL=beq)(PROGRAM=/lfs/oracle/ora11204160719V4/bin/oracle)(ENVS='TZ=Australia/Victoria,ORA_NLS10=/lfs/oracle/ora11204160719V4/nls/data,ORACLE_HOME=/lfs/oracle/ora11204160719V4,ORACLE_SID=tstdha04')(ARGV0=oracletstdha04)(ARGS='(LOCAL=NO)')) |
Test 3:
Let’s repeat the client test.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
C:\Users\qt89739>set NLS_LANG=ENGLISH_AUSTRALIA C:\Users\qt89739>sqlplus /nolog SQL*Plus: Release 11.2.0.3.0 Production on Wed Oct 25 11:31:38 2017 Copyright (c) 1982, 2011, Oracle. All rights reserved. SQL> connect resource01/@"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=)(Port=)))(CONNECT_DATA=(SID=tstdha04)))" connected SQL> select * from nls_session_parameters; PARAMETER VALUE --------------------------------- ----------------------------- NLS_LANGUAGE ENGLISH NLS_TERRITORY AUSTRALIA NLS_CURRENCY $ NLS_ISO_CURRENCY AUSTRALIA NLS_NUMERIC_CHARACTERS ., NLS_CALENDAR GREGORIAN NLS_DATE_FORMAT DD/MON/RR NLS_DATE_LANGUAGE ENGLISH NLS_SORT BINARY NLS_TIME_FORMAT HH12:MI:SSXFF AM NLS_TIMESTAMP_FORMAT DD/MON/RR HH12:MI:SSXFF AM NLS_TIME_TZ_FORMAT HH12:MI:SSXFF AM TZR NLS_TIMESTAMP_TZ_FORMAT DD/MON/RR HH12:MI:SSXFF AM TZR NLS_DUAL_CURRENCY $ NLS_COMP BINARY NLS_LENGTH_SEMANTICS CHAR NLS_NCHAR_CONV_EXCP FALSE 17 rows selected. |
Test3 – result – okay…
Now the funny part….lets revert the changes we made in the listener just before we started Test3… So remove the ORA_NLS10 parameter from the static listener configuration and reload the listener.
1 2 3 4 5 6 7 8 9 10 11 12 |
(SID_DESC = (SID_NAME = tstdha04) (ORACLE_HOME = /lfs/oracle/ora11204160719V4) (ENVS='TZ=Australia/Victoria') ) Service "tstdha04" has 1 instance(s). Instance "tstdha04", status UNKNOWN, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 LOCAL SERVER (ADDRESS=(PROTOCOL=beq)(PROGRAM=/lfs/oracle/ora11204160719V4/bin/oracle)(ENVS='TZ=Australia/Victoria,ORACLE_HOME=/lfs/oracle/ora11204160719V4,ORACLE_SID=tstdha04')(ARGV0=oracletstdha04)(ARGS='(LOCAL=NO)')) |
Test 4:
Let’s repeat the client test.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
C:\Users\qt89739>set NLS_LANG=ENGLISH_AUSTRALIA C:\Users\qt89739>sqlplus /nolog SQL*Plus: Release 11.2.0.3.0 Production on Wed Oct 25 11:33:32 2017 Copyright (c) 1982, 2011, Oracle. All rights reserved. SQL> connect resource01/@"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=)(Port=)))(CONNECT_DATA=(SID=tstdha04)))" connected SQL> select * from nls_session_parameters; PARAMETER VALUE --------------------------------- ----------------------------- NLS_LANGUAGE ENGLISH NLS_TERRITORY AUSTRALIA NLS_CURRENCY $ NLS_ISO_CURRENCY AUSTRALIA NLS_NUMERIC_CHARACTERS ., NLS_CALENDAR GREGORIAN NLS_DATE_FORMAT DD/MON/RR NLS_DATE_LANGUAGE ENGLISH NLS_SORT BINARY NLS_TIME_FORMAT HH12:MI:SSXFF AM NLS_TIMESTAMP_FORMAT DD/MON/RR HH12:MI:SSXFF AM NLS_TIME_TZ_FORMAT HH12:MI:SSXFF AM TZR NLS_TIMESTAMP_TZ_FORMAT DD/MON/RR HH12:MI:SSXFF AM TZR NLS_DUAL_CURRENCY $ NLS_COMP BINARY NLS_LENGTH_SEMANTICS CHAR NLS_NCHAR_CONV_EXCP FALSE 17 rows selected. |
Okay, so the configuration on client/listener/database server are the same as in Test2, but now we are able to connect with the NLS_LANG setting ENGLISH_AUSTRALIAN
!! Until we restart the database !!
Test 5:
Database is restarted and we repeat the client test….
1 2 3 4 5 6 7 8 9 |
C:\Users\qt89739>set NLS_LANG=ENGLISH_AUSTRALIA C:\Users\qt89739>sqlplus /nolog SQL*Plus: Release 11.2.0.3.0 Production on Wed Oct 25 11:40:15 2017 Copyright (c) 1982, 2011, Oracle. All rights reserved. SQL> connect resource01/@"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=)(Port=)))(CONNECT_DATA=(SID=tstdha04)))" ERROR: ORA-00604: error occurred at recursive SQL level 1 ORA-12705: Cannot access NLS data files or invalid environment specified |
We are back to the square 1…..and know how to resolve it (add the correct ORA_NLS10 parameter to the listener configuration), but I’d like to check something else.
Let’s start a connection on the database server, with all environment settings in place (eg. ORACLE_HOME and ORA_NLS10 pointing to the oracle 11G location).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
ORACLE_HOME=/lfs/oracle/ora11204160719V4 ORA_NLS10=/lfs/oracle/ora11204160719V4/nls/data [qt89739]tstdha04@ltdbreco5:/lfs/oracle/ora11204160719V4$ sqsys SQL*Plus: Release 11.2.0.4.0 Production on Wed Oct 25 11:42:57 2017 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production 12:35:54 SQL> connect / as sysdba Connected. 12:36:00 SQL> set lines 32000 12:36:07 SQL> select * from nls_session_parameters; PARAMETER VALUE --------------------------------------- ------------------------------------- NLS_LANGUAGE ENGLISH NLS_TERRITORY AUSTRALIA NLS_CURRENCY $ NLS_ISO_CURRENCY AUSTRALIA NLS_NUMERIC_CHARACTERS ., NLS_CALENDAR GREGORIAN NLS_DATE_FORMAT DD-MON-YYYY-HH24:MI:SS NLS_DATE_LANGUAGE ENGLISH NLS_SORT BINARY NLS_TIME_FORMAT HH12:MI:SSXFF AM NLS_TIMESTAMP_FORMAT DD/MON/RR HH12:MI:SSXFF AM NLS_TIME_TZ_FORMAT HH12:MI:SSXFF AM TZR NLS_TIMESTAMP_TZ_FORMAT DD/MON/RR HH12:MI:SSXFF AM TZR NLS_DUAL_CURRENCY $ NLS_COMP BINARY NLS_LENGTH_SEMANTICS CHAR NLS_NCHAR_CONV_EXCP FALSE 17 rows selected. |
Okay, the ‘client connection’ on the database itself went fine, now let’s check client again:
Test 6:
Let’s repeat the client test.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
C:\Users\qt89739>set NLS_LANG=ENGLISH_AUSTRALIA C:\Users\qt89739>sqlplus /nolog SQL*Plus: Release 11.2.0.3.0 Production on Wed Oct 25 11:45:32 2017 Copyright (c) 1982, 2011, Oracle. All rights reserved. SQL> connect resource01/@"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=)(Port=)))(CONNECT_DATA=(SID=tstdha04)))" connected SQL> select * from nls_session_parameters; PARAMETER VALUE --------------------------------- ----------------------------- NLS_LANGUAGE ENGLISH NLS_TERRITORY AUSTRALIA NLS_CURRENCY $ NLS_ISO_CURRENCY AUSTRALIA NLS_NUMERIC_CHARACTERS ., NLS_CALENDAR GREGORIAN NLS_DATE_FORMAT DD/MON/RR NLS_DATE_LANGUAGE ENGLISH NLS_SORT BINARY NLS_TIME_FORMAT HH12:MI:SSXFF AM NLS_TIMESTAMP_FORMAT DD/MON/RR HH12:MI:SSXFF AM NLS_TIME_TZ_FORMAT HH12:MI:SSXFF AM TZR NLS_TIMESTAMP_TZ_FORMAT DD/MON/RR HH12:MI:SSXFF AM TZR NLS_DUAL_CURRENCY $ NLS_COMP BINARY NLS_LENGTH_SEMANTICS CHAR NLS_NCHAR_CONV_EXCP FALSE 17 rows selected. |
Okay, so the configuration on client/listener/database server are the same as in Test2, but now we are able to connect with the NLS_LANG setting ENGLISH_AUSTRALIAN
Until we restart the database again, so back to square 1…..
The reason why we might see this behavior seems to be caused by Oracle NLS Runtime Library (according to the documentation: “Oracle Database globalization support is implemented with the Oracle NLS Runtime Library (NLSRTL). The NLS RTL provides a comprehensive suite of language-independent functions that perform proper text and character processing and language-convention manipulations. Behavior of these functions for a specific language and territory is governed by a set of locale-specific data that is identified and loaded at runtime.”
Conclusion:
Static listener registration on an Oracle 12C listener with and Oracle11G database REQUIRES the correct ORACLE_HOME and ORA_NLS10 parameters to be specified, otherwise it might result in strange behavior on the client when using ENGLISH in the NLS_LANG client setting !!!
Why specific ENGLISH ? Not sure about that. The size of the language file seems to be different between Oracle11G and Oracle12C, some other combinations (not using language ENGLISH) seems to work as long as the sizes of the files are the same (although md5sum will tell us the files are different):
1 2 3 |
[qt89739]tstdha04@ltdbreco5:/home/qt89739$ ls -al /lfs/oracle/ora12102160719L/nls/data/lx00025.nlb; ls -al /lfs/oracle/ora11204160719V4/nls/data/lx00025.nlb -rw-r--r-- 1 oracle dba 982 Feb 23 2014 /lfs/oracle/ora12102160719L/nls/data/lx00025.nlb -rw-r--r-- 1 oracle dba 968 Jul 23 2013 /lfs/oracle/ora11204160719V4/nls/data/lx00025.nlb |
Problematic languages found:
1 2 3 |
FRENCH - lx00003.nlb ENGLISH - lx00025.nlb LATIN AMERICAN SPANISH - lx00026.nlb |
Insightful ….