Hiding Plain Text Password With Sqlplus Command Line
Solution 1:
How do I input the password from within a shell script in this case?
You can use a heredoc:
sqlplus -s /nolog <<!EOF
connectSOME_USERNAME/SOME_PASSWORD@somedns.intra.com:1500/SOMESID
@some.sql
!EOF
The connect and @some.sql are treated as an input stream to SQL*Plus, as if you'd typed them in an interactive session, and are not part of the initial call to the executable - so the connection details don't appear in ps output.
You can also use variables if you want to, incidentally, as the variable expansion happens in the shell before it passes the stream to the executable - so even though SQL*Plus wouldn't understand say $PASSWD, referring to that in the heredoc works and the actual variable value is passed.
Solution 2:
Use
sqlplus -s SOME_USERNAME@\"somedns.intra.com:1500/SOMESID\" @some.sqland enter your password on the command line.Or use external authentication and don't use a password at all
Finally, SOMESID is not a SID, it's a Service Name. The Easy Connect syntax you use only works with service names. SIDs are very very old-school.
Post a Comment for "Hiding Plain Text Password With Sqlplus Command Line"