使用sqlplus命令行隐藏纯文本密码 [英] Hiding plain text password with sqlplus command line
问题描述
我希望使用一个sqlplus命令,其密码从视图中隐藏,这样它就不会显示在ps -ef命令中.
I wish to use a sqlplus command with password hidden from view such that it doesn't show up on ps -ef command.
我知道Internet博客上提供了许多解决方案,但是大多数解决方案似乎都需要管理员权限,并且我对此服务器的访问权限受到限制.而其他人似乎似乎对我没有用.
I know there are a lot of solutions provided all over internet blogs but most of them seem to require admin privileges and I have restricted access on this server. And rest of them just don't seem to work me.
我当前使用的命令如下:
The command that I am currently using is as below:
sqlplus -s SOME_USERNAME/SOME_PASSWORD@somedns.intra.com:1500/SOMESID @some.sql
传奇:
SOME_USERNAME:模式/用户
SOME_USERNAME: schema/user
SOME_PASSWORD:密码
SOME_PASSWORD: password
SOMESID:此数据库的SID.
SOMESID: SID for this DB.
@ some.sql:包含插入语句的sql文件.
@some.sql: An sql file containing insert statements.
任何指针都值得赞赏.
Any pointers are much appreciated.
更新:忘了提及此sqlplus命令将在shell脚本中使用.
Update: Forgot to mention that this sqlplus command will be used inside a shell script.
推荐答案
在这种情况下,如何从shell脚本中输入密码?
How do I input the password from within a shell script in this case?
您可以使用此处文档:
sqlplus -s /nolog <<!EOF
connect SOME_USERNAME/SOME_PASSWORD@somedns.intra.com:1500/SOMESID
@some.sql
!EOF
connect
和@some.sql
被视为SQL * Plus的输入流,就像您在交互式会话中键入它们一样,它们不属于对可执行文件的初始调用-因此,连接详细信息不会出现在ps
输出中.
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.
如果您愿意的话,也可以使用变量,因为变量扩展是在将流传递给可执行文件之前在外壳中发生的-因此,即使SQL * Plus不理解说$PASSWD
,也是如此在Heredoc工程中,并传递了实际的变量值.
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.
这篇关于使用sqlplus命令行隐藏纯文本密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!