Scenario:
*oracle xe11g r2 is installed( and runs properly when logged in as oracle).
*logged in as user, root
*added root to groups oinstall and dba as follows:
#useradd -G oinstall root
#useradd -G dba root
*environment variables ORACLE_HOME and ORACLE_SID are set as follows:
#export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
#export ORACLE_SID=XE
#export PATH=$ORACLE_HOME/bin:$PATH
and executed:
#sudo -u oracle sqlplus / as sysdba
Output:
sudo: sqlplus: command not found
Please guide me in running sqlplus by root using sudo.
Best Answer
Not an Oracle error.
Sure you can put the above variables in
.bash_profile
oforacle
, but when you use sudo like above, that will not be executed.One of the many ways to work around this:
I am not a fan of using
.bash_profile
for setting the Oracle environment, I suggest usingoraenv
or a custom script that is not executed automatically.