dumber_than_thou
dumber_than_thou

Reputation: 7

Getting rid of the "Enter password" message in sqlplus results?

This is probably a very silly question, but here it goes...

This is my syntax for getting some data using sqlplus in Unix command line:

echo pwd|sqlplus -S -L user@db @mysqlfile >> otherfile

It works OK, but 'otherfile' starts with the line 'Enter password:', which is pretty annoying, and it makes for extra code for parsing results. So the question is:

How do I get rid of the 'Enter password:' line? Am I doing something wrong there?

Thanks.

Upvotes: 0

Views: 288

Answers (1)

Przemyslaw Kruglej
Przemyslaw Kruglej

Reputation: 8123

It is possible if you pass the connect command to the sqlplus, along with the script you want to execute. You'll also have to utilize the /nolog and -S (silent) options:

[oracle@localhost]$ cat mysqlfile.sql 
select * from dual;
[oracle@localhost]$ (echo connect username/secretpassword ; echo @mysqlfile) | sqlplus -S /nolog >> out
[oracle@localhost]$ cat out

D
-
X

[oracle@localhost]$ 

Edit: Using your parameters:

(echo connect user/pwd ; echo @mysqlfile) | sqlplus -S /nolog >> otherfile

Upvotes: 2

Related Questions