Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: shell script lesson needed regarding oraenv script
oraenv needs to be sourced - use a dot-space in front of the file name.
Explanation:
The reason is that 'running' a shell script in most shells will invoke a 'subshell' (one that can be suspended or terminated using Ctrl-C, etc). The script is then executed in that subordinate shell.
In your case the oraenv will then set the environment variable in the subshell, which then terminates leaving the primary shell unchanged.
When you source a file - which does not necessarily have to be a shell script, and does not have to be set executable - the shell is instructed to read that file and interpret it one line at a time, as if it was typed by hand.
One gotcha is that most shells (that I know) will not allow parameters to be passed on the same line as the name of the sourced file - so you can not run ". oraenv my_sid"
HTH
/Hans
Received on Fri Nov 19 2004 - 07:49:25 CST