1753556 Members
5741 Online
108796 Solutions
New Discussion юеВ

Re: sqlplus: not found

 
ivanrc
Occasional Contributor

sqlplus: not found

I try to execute a shell script using plink.exe (plink -ssh "servermachine" -l "user" -pw "pass" /home/path../myScript.sh) and then i get the message "sqlplus: not found", but if i execute the same script in my unix machine i don't have this message an all is ok.

#!/bin/ksh
sqlplus -s ... << EOF
set echo off
set verify off
set feed off
set pagesize 0
set pause off
set linesize 4000
set trims on
set head off
set term off
set pages 0
set lines 2000
set space 0
set serveroutput on size 1000000
SPOOL /home/path/file.txt
DECLARE
...;
BEGIN
....
END;
/
SPOOL OFF
set serveroutput off
exit;
EOF
5 REPLIES 5
Dennis Handly
Acclaimed Contributor

Re: sqlplus: not found

It is likely your PATH doesn't contain sqlplus when you use plink -ssh?
rariasn
Honored Contributor

Re: sqlplus: not found

Hi,

Add ORACLE_HOME and ORACLE_SID.

rgs,
Matti_Kurkela
Honored Contributor

Re: sqlplus: not found

When you use plink to execute a script, what you're doing is called a "non-interactive login".

No matter which shell is configured for your user account on the servermachine, it probably handles interactive and non-interactive logins differently. Often some login scripts are omitted when doing a non-interactive login. This typically causes your PATH environment variable to be different from what you've used to.

Try setting PATH explicitly from the HP-UX system's standard configuration file in the beginning of your script:

#!/bin/ksh

export PATH=$(< /etc/PATH)

sqlplus -s ... <[...]

MK
MK
ivanrc
Occasional Contributor

Re: sqlplus: not found

Thanks to all, but the problem is that plink don't load the postprofile and then i have to add this load to my script.
ivanrc
Occasional Contributor

Re: sqlplus: not found

All is ok. Thanks.