Oracle environmental variables in shells script

Hi,

Getting below error on executing the shell script which initiates sqlplus

How to set oracle enviornment variables in the shell script ?

With Regards

Simple:

var=value

It seems sqlplus is not in your PATH environment variable.

Try:

export PATH=${PATH}:${ORACLE_HOME}/bin

Or check where in your environment Oracle home is.

If ORACLE_HOME is not set, you can set it in your ${HOME}/.profile or ${HOME}/.bash_profile, you can set any variable in those files and they will be available in your environment.

Just don't forget, after adding the variables to reload your profile, with logout/login or ". ${HOME}/.profile" or ". ${HOME}/.bash_profile"

Regards.

1 Like

The best way (IMHO) to set the Oracle environment is to use the Oracle-provided oraenv script.

It saves you doing it manually, and ensures that the Oracle software and database versions match, in the event that you might have multiple Oracle versions installed.

Setting the ORACLE_HOME on its own will accomplish nothing without an ORACLE_SID. oraenv will set both.

1 Like

Hi,

Your help is highly appreciated.

With Regards