I have noticed strange interaction between ORACLE_HOME and parameter substitution.
Here is my test.sql
prompt &1
prompt &2
prompt &3
prompt &4
exit
The expected behavior:
C:\cygwin64\home\rejap\subst>sqlplus /nolog @test.sql one two three four five
SQL*Plus: Release 12.2.0.1.0 Production on Sun Jun 16 15:19:16 2019
Copyright (c) 1982, 2017, Oracle. All rights reserved.
one
two
three
four
C:\cygwin64\home\rejap\subst>
however, when ORACLE_HOME is set, things get interesting
C:\cygwin64\home\rejap\subst>set ORACLE_HOME=c:\Program Files (x86)\Oracle\product12円.2.0\client_1
C:\cygwin64\home\rejap\subst>sqlplus /nolog @test.sql one two three four five
SQL*Plus: Release 12.2.0.1.0 Production on Sun Jun 16 15:21:25 2019
Copyright (c) 1982, 2017, Oracle. All rights reserved.
Files
(x86)\Oracle\product12円.2.0\client_1\sqlplus\admin\glogin.sql
three
four
C:\cygwin64\home\rejap\subst>
Am I missing something fundamental here?
Are there any negative effects of not setting ORACLE_HOME at all?
Are there any negative effects of pointing ORACLE_HOME to symlink?
c:
cd \
mklink /D oracle c:\Program Files (x86)\Oracle
set ORACLE_HOME=c:\oracle\product12円.2.0\client_1
And of course I am interested in explanation of what is going on.
2 Answers 2
sqlplus and many other programs do not require ORACLE_HOME
to be set.
In this documentation 9.2 Oracle states:
Oracle Corporation recommends that you never set the ORACLE_HOME environment variable, because it is not required for Oracle products to function properly. If you set the ORACLE_HOME environment variable, then Oracle Universal Installer will unset it for you.
I did not find similar statement for never releases of Oracle, so it might be outdated. Newer installation guides for Windows do not mention ORACLE_HOME environment variable at all, so most likely it is really not needed.
-
1I think the cited document is misleading. It does not distinguish between setting ORACLE_HOME in a specific os process/session vs. setting it system-wide for all os processes/sessions. Plus your citation is a bit out of context, because it is discussing setting variables on a system with multiple ORACLE_HOMEs, and avoiding confusion between them.EdStevens– EdStevens2019年06月17日 11:30:04 +00:00Commented Jun 17, 2019 at 11:30
-
I think in my case setting ORACLE_HOME is cargo cult. I have it set, because I believe it should be done, but I can not find any documentation which tells me "do it or else". I have only one oracle client installed and even if I had multiple, it is sqlplus which deducts ORACLE_HOME to match its own location.Pawel Jasinski– Pawel Jasinski2019年06月19日 21:55:05 +00:00Commented Jun 19, 2019 at 21:55
The fundamental that you are missing is that the command line ('sqlplus ......') is processed by the OS command processor BEFORE sqlplus gets anything. And the command processor sees every space as a delimiter for the next command line parm to be passed to whatever executable it is setting up.
-
How should I escape it? I tried ,円 " and ^, all trigger
Error 6 initializing SQL*Plus SP2-0667 ...
. Or better where in command line I execute do you see %ORACLE_HOME?Pawel Jasinski– Pawel Jasinski2019年06月19日 21:48:39 +00:00Commented Jun 19, 2019 at 21:48 -
You are correct, you did not include ORACLE_HOME in your sqlplus command line. I conflated the two statements (set ORACLE_HOME and sqlplus)statements in my own mind.EdStevens– EdStevens2019年06月20日 13:26:31 +00:00Commented Jun 20, 2019 at 13:26
c:\Program Files (x86)\Oracle
? Usually the Oracle installer does not permit it. Otherwise you may usec:\PROGRA~2\Oracle
Error 6 initializing SQL*Plus SP2-0667: Message file sp1<lang>.msb not found SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
c:\Program Files (x86)\...
is a creation of someone from IT department. You are right, the universal installer does not permit it by default.