Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: using sqlplus to login as a different user than os user.

Re: using sqlplus to login as a different user than os user.

From: Marti Rijken <mrijken_at_natrix.gld.nl>
Date: 15 Apr 1998 06:51:06 GMT
Message-ID: <6h1lb8$rsh$1@natrix.gld.nl>


Jonathan Gennick <gennick_at_worldnet.att.net> wrote:
>On 14 Apr 1998 12:01:04 -0500, dosa_at_huitzilo.tezcat.com (Ben
>Kim) wrote:
>
>>How can I login to Oracle under scott user id when
>>my Unix user id is patty using sqlplus /
>
>Try this:
>
> sqlplus scott/tiger

Or if this is too much of a burden for the average user, try hyding the information in a user-only readable file. Then create a script called `sqlplus', which reads this file and executes the real sqlplus.

I do this with the following script, because each user _must_ provide the password information in our client-server architecture.

#----------------------------------------------------------------------
ORAPATH=/opt/oracle/bin
PASSFILE=$HOME/.orapass

[ -s $PASSFILE ] || { echo "$PASSFILE missing"; exit 1; }

[ `ls -l $PASSFILE | awk '{print $1}'` != '-rw-------' ] && {

        echo "$PASSFILE: must be readable to $LOGNAME only"; exit 1; }

USERPASS=`cat $HOME/.orapass`

[ $# -gt 0 -a "$1" = '-s' ] && SILENT="-s" && shift [ $# -gt 0 -a "$1" = '/' ] && shift

exec $ORAPATH/sqlplus $SILENT $USERPASS $*

#----------------------------------------------------------------------

File USERPASS has a content like:
ops$myname/myPassword

Remember to put the script in a directory which is prior to the oracle directory in the users execution PATH.
I hope this helps.
--

   @..@ Marti Rijken <mrijken_at_prv.gelderland.nl>   (`--') private mail: mrijken_at_natrix.demon.nl  ( >__< ) URL: http://www.natrix.demon.nl/ Received on Wed Apr 15 1998 - 01:51:06 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US