Subject:            TECH: Identifying PC Clients in V$SESSION
Creator:            RPOWELL
Modified:           15 Jul 96 04:16:45          [Article Exists In GSX]



Introduction
~~~~~~~~~~~~
    This short article describes how to set up a client PC so that you can 
    determine which PC users are connected to the database using the 'OSUSER' 
    column of V$SESSION. 

    Connections from clients should use normal Oracle logins unless remote 
    operating system authentication is required. 

Warning:
~~~~~~~~
    As the USERNAME could be editted by the PC user this is not a fully
    reliable method of determining which PC user is actually connected.

Client Setup
~~~~~~~~~~~~
    On the client PC edit the ORACLE.INI file and set the parameter 'USERNAME'
    to a unique name to identify the PC. 
    Eg: USERNAME=pcuser582

    Make a connection to the server over either SQL*Net V1 or V2.

    Note: The parameter you must set is USERNAME and not SQLNET_USERNAME.

Identifying Users on the Server
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The DBA view V$SESSION should hold information about the client user
    in the OSUSER column. The following query should show the client 
    connections including the 'USERNAME' values for all PC connections:

	SELECT ALL SYS.V_$SESSION.OSUSER, SYS.V_$SESSION.USERNAME,
	           SYS.V_$SESSION.TERMINAL, SYS.V_$SESSION.PROGRAM,
	           SYS.V_$PROCESS.SPID SERVER_PID
	       FROM
	           SYS.V_$PROCESS, SYS.V_$SESSION
	       WHERE
	           SYS.V_$PROCESS.ADDR=SYS.V_$SESSION.PADDR;

    Example output looks like this:
	                                oracle@squid (PMON)	    12225
	                                oracle@squid (DBWR)	    12226
	                                oracle@squid (LGWR)	    12227
	                                oracle@squid (SMON)	    12228
	                                oracle@squid (RECO)	    12231
	pcuser582    SCOTT   Windows PC C:\ORAWIN\BIN\PLUS31.EXE    18765
	                               (TCP Two-Task)

Additional Views
~~~~~~~~~~~~~~~~
    In Oracle release 7.2 the view V$SESSION_CONNECT_INFO is introduced.
    This also has an OSUSER column which should match the above query and also
    includes the SQL*Net banner for the connection.