NLS_LANG AL32UTF8/UTF8 for Oracle database I recently installed a new Oracle database on Ubuntu using this tutorial.

I got an error

oracle@ubuntu:/home/bruno$ echo $NLS_LANG
/u01/app/oracle/product/11.2.0/xe/bin/nls_lang.sh
oracle@ubuntu:/home/bruno$ /u01/app/oracle/product/11.2.0/xe/bin/nls_lang.sh
AMERICAN_AMERICA.AL32UTF8
oracle@ubuntu:/home/bruno$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Thu Mar 17 11:00:45 2016
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
ERROR:
ORA-12705: Cannot access NLS data files or invalid environment specified
Enter user-name: 


After searching, I found a possible solution:

oracle@ubuntu:/home/bruno$ export NLS_LANG=AMERICAN_AMERICA.UTF8
oracle@ubuntu:/home/bruno$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Thu Mar 17 11:03:15 2016
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL&gt;  


What is the most elegant way to correct this error?



Answer 

export NLS_LANG = $($ORACLE_HOME/bin/nls_lang.sh)
In the original tutorial:

export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`


Notice the backticks. The value of NLS_LANG variable should be the output of the above command, not the file name with absolute path. Just set the value of NLS_LANG, as you already did:

export NLS_LANG=AMERICAN_AMERICA.AL32UTF8