 |
|
Setting
Environmental Variables with oraenv
Oracle Database Tips by Donald Burleson |
Oracle provides a script called oraenv that can be
used to change the environmental variables $ORACLE_HOME,
$ORACLE_SID, and $PATHto allow a
user to connect to a given database instance (a database instance is
often referred to as a 'sID? or Oracle System Identifier).
It can then be used again to switch to a different SID easily, even if
the ORACLE_HOME for the new SID is different.
There are two methods for using the
oraenv script. The first
method is interactive, with the script asking the user to type in the
SID. To make oraenv export
the variables to the shell environment, it must be preceded with a
period and a space as seen in Figure 6.5.
The second method for using
oraenv is non-interactive.
This is done by setting the variables $ORAENV_ASK=NO and $ORACLE_SID=<sid>
and then running the script with a period and space before it. This
time, oraenv will not ask
for the SID. It will use the one it finds in the variable $ORACLE_SID.
This non-interactive method is useful when calling
oraenv from a script.
Figure 6.5 demonstrates using oraenv. The
which command attempts to
find the path to the dbca
program. This command cannot find
dbca in any of the directories identified by the $PATHvariable, and it reports the error. After running the
oraenv script using * for
the SID, the $PATH environmental variable is set properly and
dbca is found.
 |
If you want to learn RAC at home, get the bestselling book "Personal
Oracle Real Application Clusters" by Edward Stoever.
You can buy it direct from the publisher for 30%-off and get
instant access to the code depot of Oracle tuning scripts. |
|