Re: Q: Get OS Userid

From: Brian T. Walker <walkerb_at_bach.seattleu.edu>
Date: 21 Jun 1994 14:29:56 -0700
Message-ID: <2u7m4k$q08_at_bach.seattleu.edu>


In article <FGSchulz.19.0008E9C6_at_engprn.mobil.com>, Fred Schulz <FGSchulz_at_engprn.mobil.com> wrote:
>The following query returns both the Oracle and system user id.
>
>SELECT P.USERNAME, S.USERNAME
>FROM V$PROCESS P, V$SESSION S
>WHERE P.ADDR=S.PADDR AND
>S.AUDSID = USERENV('SESSIONID');
>
>When using Windows and SQL*Net TCP/IP, it seems to return OraUser-T, or if the
>DOS environment variable USER is set to, say, DosUser, then it returns
>DosUser-T.
>
>Can anyone confirm this behavior under Windows?
>
>Thanks,
>Fred Schulz

For SQL*Net for Windows to work correctly, there are two windows environment variables that need to be set (these variables cannot be set in the DOS environment since SQL*Net for Windows doesn't read them there):

    username # used for o/s authentication at db login     sqlnet_username # used for o/s process authentication (v1 only)

These variables can be set in ORACLE.INI or in the [Oracle] section of WIN.INI. The table below shows the results of different combinations of the variables:

    SQL*Net USERNAME SQLNET_USERNAME PROCESS NAME SESSION NAME

  • --------- --------------- ------------ ------------------ v1/v2 (not set) (not set) (not set) (OPS$ Login Fails) v1/v2 (not set) walkerb (not set) (OPS$ Login Fails) v1/v2 walkerb (not set) daemon OPS$WALKERB v2 walkerb walkerb daemon OPS$WALKERB v1 walkerb walkerb *walkerb OPS$WALKERB
    • This only shows up as the sqlnet_username if the user also has an o/s account of the same name - otherwise it appears as a daemon process.

Testing was performed with the following configuration:

	Host:	HP9000/I70 (o/s 9.04)
		Oracle 7.0.16.4.0
		SQL*Net TCP/IP 1.2.7.7.1
		SQL*Net TCP/IP Adapter 2.0.15.0.0

	Client:	Dell 466/L (o/s DOS 6.21)
		SQL*PLus 3.1.1.9.3
		SQL*Net TCP/IP 1.1.7.8
		SQL*Net TCP/IP Adapter 2.0.14.0
Received on Tue Jun 21 1994 - 23:29:56 CEST

Original text of this message