Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Information for every client connected to the database
Comments in line
"benazir" <benazir_zardari_at_yahoo.com> wrote in message
news:35a97e60.0405061938.6ebf107_at_posting.google.com...
> Hi,
>
> I am using the following query in order to get some information like
> Database Username, Client IP Address, Server IP Address, and Server
> Name.
>
> How should we get the Client Name? What syntax I add in the following
> query in order to get client name?
The name of the osuser and the name of the the client pc are both recorded in V$SESSION as well.
> In addition the following query did not give the Client_IP Address of
> other users who are connected to the database, when I query it as
> sysdba.
>
>
> SQL> select username,sys_context('USERENV','IP_ADDRESS') Client_IP,
> utl_inaddr.get_host_name SERVER_IP,utl_inaddr.get_host_name
> DB_Server_Name
> from V$session where username is not null;
>
> Could some one please assist me about the problem?
well sys_context relates to the user issuing the query so that would return your ip address for each row.
To run as a query I would probably just issue
select username,osuser,machine from v$session where username is not NULL;
If this is for auditing purposes and the audit session command is insufficient. I'd be looking at a trigger which did call SYS_CONTEXT as that would fire for the connecting session and recording this either in a table or in a log file via UTL_FILE.
-- Niall Litchfield Oracle DBA Audit Commission UK http://www.niall.litchfield.dial.pipex.com/Received on Fri May 07 2004 - 04:31:57 CDT
![]() |
![]() |