暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

How can I start an SQL*Plus batch without showing the id/password on the command line ?

2011-01-01
691

The Oracle (tm) Users' Co-Operative FAQ

How can I start an SQL*Plus batch without showing the id/password on the command line ?


Author's name: Connor McDonald

Author's Email: connor_mcdonald@yahoo.com

Date written: August 13, 2001

Oracle version(s): 7.3+

How can I start an SQL*Plus batch without showing the id/password on the command line ?


This is predominantly a unix-based issue, since anyone with a login account on the server where oracle is running can typically run a 'ps' command and see the user name and password of any sqlplus sessions that are active

Some options you can use to avoid this are:

  • Use OS accounts

    Presuming you are logging in to the unix box as "oracle", you can create an account "OPS$ORACLE" as being "IDENTIFIED EXTERNALLY". Once this is done, then connections can be done as:

    sqlplus / @script_to_run
    
  • Use "internal" or a dummy account, then change

    In this situation you connect initialy as internal (this does not expose any passwords since only people with the appropiate unix privileges will be able to do this), and then optionally within the SQL script that you wish to run, for example:

    sqlplus internal @script_to_run
    where "script_to_run" contains "connect myuser/mypass" as the first line
    

    The dummy account option is to create a well-known account such as "dummy/dummy" that only has create session privileges. It could be argued that this is still a security risk since so many objects are typically granted select/execute/etc to public nowadays.

  • (8i) Use /NOLOG

    Same as above, but from 8i, you can start SQL Plus without establishing a connection

    sqlplus /NOLOG @script_to_run
    
  • Use standard input

    In the absence of any other instructions, SQL Plus will take the username and/or password from standard input, for example

    !/bin/ksh
    print mypassword | sqlplus username @script_to_run
    

A C program (hide.c) used to be published on Metalink which would allow you to hide passwords from the process listing. Whilst its probably still there somewhere, its easier to use one of the options presented above.


Further reading: N/A



最后修改时间:2020-04-16 15:13:15
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论