简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM