Thursday, August 27, 2009

oraenv

The oraenv and coraenv utilities both aid in setting the Oracle environment on UNIX systems (other utilities exist on Windows platform that enable the Oracle Home to be set.) The coraenv utility is appropriate for the UNIX C Shell; oraenv should be used with either the Bourne or Korn shells.



Database operations require the ORACLE_HOME to be set before the user may access the database. If ORACLE_HOME is not set, commands such as sqlplus, exp, or any other utility for that matter, will not be found.



Both utilities are shell scripts that do the same thing in the different UNIX shells. They will prompt for a SID of the database unless ORAENV_ASK is set to N. The utility will also append the ORACLE_HOME value to the path, marking the location of the utility.



The oraenv command will prompt for the SID of the database that you wish $ORACLE_HOME to access.

$ . oraenv
ORACLE_SID = [] ?



if its already set in oracle user's profile or export earlier in the same session then it behave as below:

$oraenv

ORACLE_SID = [IMANYDME] ?



The dbhome utility can now be used to verify that $ORACLE_HOME is correct.
$ dbhome
/data1/oracle/oracle/product/10.2.0/db_1



The “dot space” part of the command is required to make the environment change with the parent shell, as opposed to entering a command without it which would only affect the subshell running that process.

These commands can be used to avoid specifying the network service name when issuing commands. For instance, without using oraenv, a sqlplus command would look like:
$ sqlplus system/manager@nameofservice as sysdba

whereas after oraenv has been executed, the following command would work:
$ sqlplus system/manager as sysdba

No comments:

Post a Comment