sqlplus "command not found" connecting with ssh - SSH
This is a discussion on sqlplus "command not found" connecting with ssh - SSH ; Hi you all,
I'm trying to execute an script which uses sqlplus from a remote ssh
client.
The script runs ok executing it from the server.
I'm executing the following line: ssh user@host script.sh
The script only connects sqlplus (sqlplus ...
-
sqlplus "command not found" connecting with ssh
Hi you all,
I'm trying to execute an script which uses sqlplus from a remote ssh
client.
The script runs ok executing it from the server.
I'm executing the following line: ssh user@host script.sh
The script only connects sqlplus (sqlplus user@pass/DB_SID)
And I get the followin message:
bash: sqlplus: command not found
Any ideas?
Thanks a lot
-
Re: sqlplus "command not found" connecting with ssh
On 11 Dec 2006 04:41:38 -0800
"_mamarin_" wrote:
> Hi you all,
>
> I'm trying to execute an script which uses sqlplus from a remote ssh
> client.
> The script runs ok executing it from the server.
>
> I'm executing the following line: ssh user@host script.sh
> The script only connects sqlplus (sqlplus user@pass/DB_SID)
> And I get the followin message:
> bash: sqlplus: command not found
>
>
> Any ideas?
>
> Thanks a lot
>
You probably need to either specify the entire path to SQLPlus, similar to /opt/oracle/920/bin/sqlplus, or set your environment PATH prior to running SQLPlus to include the directory where SQLPlus exists.
Doug
--
For UNIX, Linux and security articles
visit http://SecurityBulletins.com/
-
Re: sqlplus "command not found" connecting with ssh
Thanks to you all...
"sourcing" the bash_profile into my script was the besto option at
least!!
#!/bin/bash
.. ~/.bash_profile

Doug Spencer ha escrito:
> On 11 Dec 2006 04:41:38 -0800
> "_mamarin_" wrote:
>
> > Hi you all,
> >
> > I'm trying to execute an script which uses sqlplus from a remote ssh
> > client.
> > The script runs ok executing it from the server.
> >
> > I'm executing the following line: ssh user@host script.sh
> > The script only connects sqlplus (sqlplus user@pass/DB_SID)
> > And I get the followin message:
> > bash: sqlplus: command not found
> >
> >
> > Any ideas?
> >
> > Thanks a lot
> >
>
> You probably need to either specify the entire path to SQLPlus, similar to /opt/oracle/920/bin/sqlplus, or set your environment PATH prior to running SQLPlus to include the directory where SQLPlus exists.
>
> Doug
>
> --
> For UNIX, Linux and security articles
> visit http://SecurityBulletins.com/
-
Re: sqlplus "command not found" connecting with ssh
_mamarin_ wrote:
> Thanks to you all...
>
> "sourcing" the bash_profile into my script was the besto option at
> least!!
>
That's what you needed to do. Remember that when you remotely execute a
script, it's just like executing it from cron - you get a bare minimum
shell environment. If any command in your script depends on environment
variables like PATH or LD_LIBRARY_PATH, it's a good practice to
explicitly set them in your script. Sqlplus us one such command. Oracle
provides a script named oraenv for doing that. You source it in your script.
export ORACLE_SID=YOURSID
export ORAENV_ASK=NO
.. oraenv # (or ./usr/local/bin/oraenv)
[ rest of script ]