Oracle Database - oraenv and coraenv script to set Linux environment variable

1 - About

This section describes how to set a common operating system environment (environment variable) by using the oraenv or coraenv scripts, depending on the default shell:

  • For the Bourne, Bash, or Korn shell, use the oraenv command.
  • For the C shell, use the coraenv command.

Do not call the oraenv or coraenv script from the Oracle software owner (typically, oracle) user's shell startup script. Because these scripts prompt for values, they can prevent the dbstart script from starting a database automatically when the system starts.

The oraenv or coraenv script is usually called from the user's shell startup file (for example, .profile or .login). It sets the ORACLE_SID and ORACLE_HOME environment variables and includes the $ORACLE_HOME/bin directory in the PATH environment variable setting.

The oraenv and coraenv scripts are created during installation. These scripts set environment variables based on the contents of the oratab file and provide:

  • A central means of updating all user accounts with database changes
  • A mechanism for switching between databases specified in the oratab file

3 - To switch between databases

You may find yourself frequently adding and removing databases from the development system or your users may be switching between several different Oracle Databases installed on the same system. You can use the oraenv or coraenv script to ensure that user accounts are updated and to switch between databases.

When switching between databases, users can run the oraenv or coraenv script to set these environment variables.

4 - How to run the script

To run one of these scripts, use the appropriate command:

  • coraenv script:
% source /usr/local/bin/coraenv
  • oraenv script:
$ . /usr/local/bin/oraenv

5 - Documentation / Reference

db/oracle/oraenv.txt ยท Last modified: 2017/09/06 19:28 by gerardnico