Thursday, September 4, 2014

root.sh - Purpose of oraenv, coraenv & dbhome

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 = [] ? ASG920

The dbhome utility can now be used to verify that $ORACLE_HOME is correct.

$ dbhome

/usr/oracle/9.2.0

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



Source: http://blog.abigold.fr/joomla/index.php?option=com_content&view=article&id=200:oraenvcoraenvdbhome&catid=41:command-batch-utility-utilitaire&Itemid=66

No comments:

Post a Comment