Database Administration (MOSC)

MOSC Banner

how to find connected users

edited Jun 19, 2015 10:03AM in Database Administration (MOSC) 4 commentsAnswered

In some archived discussion thread on OTN I found the following answer to my question (to find the currently connected users to a database):

col ip_address format a16<br/><br/>select<br/>  username,<br/>  osuser,<br/>  terminal,<br/>  utl_inaddr.get_host_address(terminal) IP_ADDRESS<br/>from<br/>  v$session<br/>where<br/>  username is not null<br/>order by<br/>  username,<br/>  osuser;

Feeding this to SqlPlus (under 11g) I'm getting:

C:\Bench\Oracle\import\si>sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Fri Jun 12 11:13:37 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

SQL> connect / as sysdba
Connected.
SQL> col ip_address format a16
SQL>
SQL> select
  2    username,
  3    osuser,
  4    terminal,
  5    utl_inaddr.get_host_address(terminal) IP_ADDRESS
  6  from
  7    v$session
  8  where
  9    username is not null
 10  order by
 11    username,
 12    osuser;
  utl_inaddr.get_host_address(terminal) IP_ADDRESS
  *
ERROR at line 5:
ORA-29257: host unknown unknown
ORA-06512: at "SYS.UTL_INADDR", line 19
ORA-06512: at "SYS.UTL_INADDR", line 40
ORA-06512: at line 1


SQL>

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center