Sqlplus not working through ssh

Hi Gurus,

I was trying to execute sqlplus command remotely like

ssh -q IP venkat@"which sqlplus"

am getting error as which: no sqlplus in (/usr/local/bin:/bin:/usr/bin)

if i connect manually and executing which sqlplus it working fine.
Please help to fix the issue.

Regard's
Venky

That ssh command can't possibly work, and I'd be surprised if the error msg mentioned would show up. You need

  • a target machine
  • the remote command separated by a white space

What is the IP parameter for?

Hi Rudic,

Sorry its a typo

ssh -q venkat@IP_ADDRESS "which sqlplus"

Regard's
Venky

Pls. post the result of

ssh -q venkat@IP_ADDRESS "echo $PATH"

and

echo $PATH

when "connect(ed) manually".

Hi Rudic,

here is the output in remote exec

/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/venkat/bin

when manually

echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/venkat/bin

regard's
venky

Somewhat surprising... the PATH mentioned in the error msg in post#1 is much shorter that the one you show in post#5. Is that for the same user? Where does sqlplus actually reside? What are the permissions on it? How do you "manually" login?

Oracle is almost never installed in the /usr tree, and should not be there. Those PATH variables will not work for a "normal" oracle install.

Normally oracle uses $ORACLE_HOME , wherever $ORACLE_HOME points

Please post the output of:

echo 'HERE' 
set
echo 'THERE' 
ssh venkat@$IP_ADDRESS  set

Your problem is in how the environment is defined on the remote machine - assuming sqlplus works on your local machine

$ORACLE_HOME must be defined correctly to start with and whatever $ORACLE_HOME/bin is, has to be in the PATH variable as well. Note: $ORACLE_HOME/bin could end with some different subdirectory, not just simply "/bin" on machines that have both old versions and newer versions of oracle (32 bit vs 64 bit)
installed.
The reason sqlplus needs the ORACLE_HOME variable defined is to find adjunct files like .msb files. Without it defined, sqlplus will start (sort of) then you get some really odd error messages.

Hi Gurus,

Thanks for the support, sorry for the late reply.

My issue got resolved as User venkat is not a member of database group to use lib's for oracle, and while am executing manually am using it with sudo.