Sqlplus error - sqlplus -s <login/password@dbname> : No such file or directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sqlplus error - sqlplus -s <login/password@dbname> : No such file or directory
# 1  
Old 03-18-2014
Sqlplus error - sqlplus -s <login/password@dbname> : No such file or directory

i am using bash shell
Whenever i declare an array, and then using sqlplus, i am getting sqlplus error and return code 127.


Code:
IFS=","
declare -a Arr=($Variable1);

SQLPLUS=sqlplus -s "${DBUSER}"/"${DBPASS}"@"${DBASE}
echo "set head off ; " > ${SQLCMD}
echo "set PAGESIZE 0 ;" >> ${SQLCMD}
echo "select columnname from tablename where colume = '${ABC}';" >> ${SQLCMD}
variable3=`${SQLPLUS} @${SQLCMD}`


Last edited by Don Cragun; 03-18-2014 at 05:21 AM.. Reason: Add CODE tags.
# 2  
Old 03-18-2014
try the below
Code:
SQLPLUS="sqlplus -s ${DBUSER}/${DBPASS}@${DBASE}"

you can even try the below for sqlplus
Code:
sqlplus -s ${DBUSER}/${DBPASS}@${DBASE} <<! | read variable3
set head off;
set pagesize 0;
select columnname from tablename where colume = '${ABC}';
exit;
!

# 3  
Old 03-18-2014
export these variable:
Code:
SQLPLUS_PATH= path of sqlplus client  export LD_LIBRARY_PATH=$SQLPLUS_PATH
 export PATH=$PATHSQLPLUS_PATH  
cd $SQLPLUS_PATH  

sqlplus <DBUSERNAME>/<DBPASSWORD>//<IP>:<PORT>/<SID>

# 4  
Old 03-18-2014
Hi Srini,
i tried using your method. Wheneever i am using IFS=",", sqlplus is throwing me error. If i comment out IFS=",", then sqlplus runs without any problem. Has this something to do with the shell?
What is the way to use array in shell?
Variable=MKT1,MKT2
Basically i want to capture MKT1 and MKT2 in array seperately. Comma is the delemiter. In bash,
IFS=","
declare -a Arr=($Variable);
# 5  
Old 03-18-2014
where do you want to use the array values inside sqlplus?
# 6  
Old 03-18-2014
No, i donot want to use the array variable inside sqlplus
# 7  
Old 03-18-2014
Tyr the below
Code:
variable3=$(sqlplus -s ${DBUSER}/${DBPASS}@${DBASE} <<!
set head off;
set pagesize 0;
select columnname from tablename where colume = '${ABC}';
exit;
!)

If you dont want to use IFS in sql, you can change IFS after you are done with IFS. Let's say you want to use IFS below sql, you can do this way

Code:
old_IFS="${IFS}"
IFS=","
... code that uses ',' as IFS
IFS="${old_IFS}"
... sqlplus code
IFS=","
... rest of the code
IFS="${old_IFS}"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

SQLoader & SQLplus error ?

Hi experts, I have got the following errors when running my sqloader script : Can anyone give me a hand ? ERROR: ORA-12154: TNS:could not resolve the connect identifier specified SP2-0306: Invalid option. Usage: CONN ] where <logon> ::= <username> <proxy> ::= <proxyuser>... (14 Replies)
Discussion started by: Jaewong
14 Replies

2. Ubuntu

sqlplus: No such file or directory

Hello, I installed on my ubuntu 8.04.4 the oracle instant client 10.2.0.4.0 and that installation worked correctly as I can connect the oracle instances. Now I'm trying to get sqlplus to work but haven't been successful. Here is the error I get: # sqlplus -bash:... (5 Replies)
Discussion started by: daniloviz
5 Replies

3. UNIX for Dummies Questions & Answers

SQLPLUS Password Parameter file being used when logging in

Good day to everyone. This is my first time posting and just barely above basic Unix training. I think i have search thoroughly to ensure my question hasn't already been posted. But on the off chance the answer has been posted, please be nice as I am not 100% sure I know what I am looking for. I... (1 Reply)
Discussion started by: Mrjester
1 Replies

4. UNIX for Dummies Questions & Answers

Passing a Unix parameter to SQLPlus login command

hi All, i m trying to pass a user choice paramter from unix to sqlplus connect command here i want the user to enter the username and password he wants to connect in sql plus through read in unix and then automatically connect to that instance. sqlplus -s $1/$2 where $ 1 and $2 will b... (2 Replies)
Discussion started by: Jcpratap
2 Replies

5. Shell Programming and Scripting

SQLPLUS Error Capturing

This is my .sh file sqlplus -s my_user/my_pswd@mydb @my_sql.sql ret_code=$? if then echo "return code is $ret_code " echo "Failed" else echo "return code is $ret_code " echo "Success" fi ===================================================== and my_sql.sql is whenever... (4 Replies)
Discussion started by: emailsafath2011
4 Replies

6. Shell Programming and Scripting

sqlplus error output to different error log file

HELLO, I am using such a command to write oracle sqlplus query result to text file: sqlplus -S xxx/xxx@xxxxxxx @\tmp\2.sql>\tmp\123.txt Is it possible to script that: If command succesfull write in \tmp\log.txt: timestamp and "succeded" and create 123.txt with results else If error... (2 Replies)
Discussion started by: tomasba
2 Replies

7. Shell Programming and Scripting

error running sqlplus from shell file

I am running a shell file following script on bash shell in solaris 10 ( echo abc@orcl echo abc echo "set feedback off" echo "truncate table SIndexDataTypeHst1_changes;" ) | sqlplus -s but getting the following error ERROR: ORA-01005: null password given; logon denied ... (3 Replies)
Discussion started by: mmunir
3 Replies

8. Shell Programming and Scripting

SQLPLUS error

I am running a script that invokes SQLPLUS. During the execution I get the following: SQL*Plus: Release 9.2.0.8.0 - Production on Mon Jun 11 16:12:50 2007 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to: Oracle9i Enterprise Edition Release 9.2.0.8.0 -... (3 Replies)
Discussion started by: ssmith001
3 Replies

9. UNIX for Dummies Questions & Answers

error connecting to sqlplus

Hi, I wrote a shell script to call oracle procedure. But when i am trying to connet sqlplus with the fallowing statement It is giving me error " callproce.sh : sqlplus: not found". What could be the problem. sqlplus -s $CONNECT_STRING >$LOGFILE <<!! thank u all papachi (2 Replies)
Discussion started by: papachi
2 Replies

10. Shell Programming and Scripting

sqlplus -s error capture

Hi folks a wee problem that requires some help. I am writing a script that allows me to automate the changing of a password in sqlplus the problem i encounter is that the code contains a case statement that allows the helpdesk to select whether to allow or deny access by switching the... (1 Reply)
Discussion started by: w33man
1 Replies
Login or Register to Ask a Question