How does one prepare the Oracle environment?
Oracle ships with two utilities to help users prepare the Oracle environment: oraenv and coraenv. One must run "oraenv" or "coraenv" as part of the current environment to set the necessary variables like ORACLE_HOME and ORACLE_SID. To switch from one database or instance to another, just re-execute either oraenv or coraenv.
The coraenv utility is appropriate for the UNIX C Shell:
$ source /usr/local/bin/coraenv ORACLE_SID= [default]? orcl
oraenv should be used with the other shells like the Bourne, Korn, or Bash shells:
$ . /usr/local/bin/oraenv ORACLE_SID= [default]? orcl
Never set the Oracle Home directory explicitly in a script. The following examples shows how to use oraenv and coraenv non-interactively from a script:
C-Shell example:
setenv PATH ${PATH}:/usr/local/bin setenv ORACLE_SID orcl setenv ORAENV_ASK NO source /usr/local/bin/coraenv
Here is a SH, KSH or BASH example:
export PATH=${PATH}:/usr/local/bin export ORACLE_SID=orcl export ORAENV_ASK=NO . oraenv
NOTE: the ". " in front of "oraenv" is required to run the script as part of the current shell.
- Log in to post comments