This content has been marked as final. Show 5 replies
977452 wrote:I assume you not finding the 'sqlplus' excutable.
Hi, I am new to Shell scripting. I am trying to connect to remote oracle system, but i am getting Sqlplus not found error. i have sqlplus executable inside bin under oracle home but still i am getting the same error. can any one guide me to get this thing done.
sqlplus -s /NOLOG <<EOF
select * from dual;
When you echo PATH:
is it on that path ?
is it at:
Or is it elsewhere? e.g:
Is your ORACLE_HOME correct ?
it there a permissions problem ?
ls -la /opt/oracle/oracle11g/product/11.2.0/bin/sqplus
.... just some thoughts .....
well i am a bit confused. when i execute echo $ORACLE_HOME on remote ORACLE system then i get "/opt/oracle/oracle11g/product/11.2.0" which is what i have set on my local unix system. now when i execute echo $ORACLE_HOME on my local system it says "Variable not found". so where exactly i am setting this variable and how this export command work.
Please describe in more detail what you are doing. Are you running 2 scripts or is it all in one script? If you are defining the Oracle variables in a separate script, you need to source execute the script.
Source executing a script means the commands in the script are run as if you are typing them at the current command prompt. A script that is not source executed will loose the variables you set inside the script when the script exits. You can source execute a script using the ".<space>script" or "source script" (bash). The export command adds variables to the environment of subsequently executed commands.
Check the following examples:
cat > shelltest <<EOF echo \$a a=b EOF chmod u+x shelltest
Test1: $ a=a $ ./shelltest $ echo $a a Test2: $ export a=a $ ./shelltest a $ echo $a a Test3: $ . ./shelltest a $ echo $a b
977452 wrote:You need an Oracle client installation. The most appropriate one is Oracle Instant Client. You need to download 2 zips. The basic Instant Client that provides the client driver. And the zip that includes SQL*Plus.
I am trying to connect to remote oracle system, but i am getting Sqlplus not found error.
Unzip both these to the same directory. E.g. +$HOME/instantclient_11_2+
Next, set the following variables in your profile (typically +$HOME/.bash_profile+ on Linux):
To find the SQL*Plus executable:
To find the Oracle drivers:
Optionally, to find the tnsnames.ora and sqlnet.ora files:
No other environment settings are really needed.