Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Client Name
Marjina wrote:
> Hi,
>
> I wanted to get the clients name that are currently connected to the database.
> Should I use SYS_CONTEXT ('USERENV', 'TERMINAL') in order to get the Client name?
> Your suggestion will be appreciated.
>
> Thanks
>
> Marjina
I suppose that would do it, though if we're talking about simple SQL you could equally well get the information from v$session:
C:\Documents and Settings\Howard>sqlplus scott/tiger_at_lx10
SQL*Plus: Release 9.2.0.1.0 - Production on Mon Apr 19 18:09:08 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select server, osuser, process, machine, terminal
2 from v$session where username='SCOTT';
SERVER OSUSER PROCESS MACHINE --------- ------------------------------ ------------ -----------------TERMINAL
DEDICATED Howard 2344:508 DIZWELL\SHOSTAKOVICHSHOSTAKOVICH I'm not sure what you meant by getting the "client's name", but that little lot shows my Windows username ("Howard"), my Windows PC's hostname ("Shostakovich") and the Domain name ("Dizwell"), which should cover most eventualities.
Regards
HJR
Received on Mon Apr 19 2004 - 03:12:55 CDT