Oracle Administration

The oraenv Script

The oraenv script is a standard Oracle script which configures your Oracle related environment variables so is important but sometimes can be hard to find. It all depends how the server is setup of course. There are two ways to find it if your path is not correctly setup. You can search for it, or you can follow some simple steps to find it.

Searching

Quite simply do this:
find / -name 'oraenv' 2>/dev/null
Then you can easily create a convenient soft link to it as follows:
ln -s /path_where_you_found_it/oraenv ~/oraenv
Which creates a soft link to the real file in your home directory, or you can modify your profile script.

Finding

On a Database Server you can do this: cat /etc/oratab
This should list your databases and their Oracle home directories. The oraenv script should reside in ORACLE_HOME/bin/oraenv where the value of ORACLE_HOME comes from the oratab file.

Startup

These are the steps I needed to do on an Oracle Linux VM, with two databases installed and no autostart configured:

  • . oraenv
    TEST1
  • lsnrctl start
  • sqlplus /nolog
    connect system as SYSDBA
    startup
    exit
  • . oraenv
    TEST2
  • sqlplus /nolog
    connect system as SYSDBA
    startup
    exit
In summary this sets the Oracle environment, starts the listener, starts the first database, updates the Oracle environment and starts the second database. I am sure there is a better way but it works.