Re: How to hide sqlplus login/passwd

From: Arjan van Bentem <avbentem_at_DONT-YOU-DAREdds.nl>
Date: 1998/12/11
Message-ID: <74ruq8$ku8$1_at_newton.a2000.nl>#1/1


Andrey A. Kulaga wrote
>$ sqlplus -s scott/tiger _at_script.sql

To hide passwords from ps -ef when running SQL*Plus, use

    echo scott/tiger | sqlplus -s _at_script.sql

or

    echo tiger | sqlplus -s scott _at_script.sql

or

    sqlplus -s scott _at_script.sql < scott.pwd > my_log.out

where the file scott.pwd just has one line (indeed: tiger) and is of course only readable for Scott. Or:

    sqlplus -s _at_script.sql > my_log.out << EOF     scott
    tiger
    EOF where the both EOFs could be replaced by anything, like 'MyMarker' (search your Unix doc for "Here Documents"). Or:

    sqlplus -s scott << EOF
    tiger
    begin
      ..
    end;
    /
    EOF
    echo "Exitcode: $?"

and even

    COUNT=$( sqlplus -s scott << EOF
    tiger
    set pagesize 0
    set feedback off
    select count(*)
    from user_tables;
    EOF
    )
    echo "Count is: ${COUNT}"

Between the two EOFs the normal substitution is performed. Like:

    USR=scott
    PWD=tiger
    COUNT=$( sqlplus -s ${USR} << EOF
    ${PWD}
    set pagesize 0
    set feedback off
    select count(*)
    from all_tables
    where owner = upper( \'${USR}\' );
    EOF
    )
    echo "Count for user ${USR} is: ${COUNT}"

Finally, if you want Scott to be identified by his Unix login, see your Oracle manuals for OPS$ users. This way, you don't need any password at all to use SQL*Plus.

Arjan. Received on Fri Dec 11 1998 - 00:00:00 CET

Original text of this message