Suppressing passwd when calling sqlplus from shell

2019-07-20 15:07发布

问题:

My script calls sqlplus in the standard format:

sqlplus $USER/$PASSWD@$DBNAME

Obviously, this is not very safe because ps -ef displays the entire command, including the passwd.

How can I invoke sqlplus without a manual prompt but still hide the passwd?

Thanks

回答1:

What you need is a different method of authentication, such as the Oracle Wallet.

Here's a walk-through in the documentation.

http://docs.oracle.com/cd/E11882_01/network.112/e16543/authentication.htm#CBHGEBEI



回答2:

BAD:

sqlplus $USER/$PASSWD@$SID<<!!

...
--some SQL
...

!!

ps -ef displays connect string

GOOD:

sqlplus /nolog<<!!

connect $USER/$PASSWD@$SID;

...
--some SQL
...

!!

ps -ef does not display connect string