Use the V$SESSION view. V$SESSION displays session information for each current session. Either you don't have permissions, or you didn't install the DBA views correctly. You'll need the select_catalog_role role.
Viewing SessionsIn SQL Developer, click Tools, then Monitor Sessions. A Sessions tab is displayed. Figure 8-1 shows part of the display. See the chapter about monitoring database operations in Oracle Database Administrator's Guide for more information.
Description. You can find all users currently logged into Oracle by running a query from a command prompt. In Oracle/PLSQL, there is a system view called V$SESSION which shows the session information for each current session in the database.
V$ACTIVE_SESSION_HISTORY displays sampled session activity in the database. It contains snapshots of active database sessions taken once a second. A database session is considered active if it was on the CPU or was waiting for an event that didn't belong to the Idle wait class.
Use the V$SESSION
view.
V$SESSION
displays session information for each current session.
For a more complete answer see: http://dbaforums.org/oracle/index.php?showtopic=16834
select
substr(a.spid,1,9) pid,
substr(b.sid,1,5) sid,
substr(b.serial#,1,5) ser#,
substr(b.machine,1,6) box,
substr(b.username,1,10) username,
-- b.server,
substr(b.osuser,1,8) os_user,
substr(b.program,1,30) program
from v$session b, v$process a
where
b.paddr = a.addr
and type='USER'
order by spid;
When I'd like to view incoming connections from our application servers to the database I use the following command:
SELECT username FROM v$session
WHERE username IS NOT NULL
ORDER BY username ASC;
Simple, but effective.
select s.sid as "Sid", s.serial# as "Serial#", nvl(s.username, ' ') as "Username", s.machine as "Machine", s.schemaname as "Schema name", s.logon_time as "Login time", s.program as "Program", s.osuser as "Os user", s.status as "Status", nvl(s.process, ' ') as "OS Process id"
from v$session s
where nvl(s.username, 'a') not like 'a' and status like 'ACTIVE'
order by 1,2
This query attempts to filter out all background processes.
Select count(1) From V$session
where status='ACTIVE'
/
select
username,
osuser,
terminal,
utl_inaddr.get_host_address(terminal) IP_ADDRESS
from
v$session
where
username is not null
order by
username,
osuser;
select status, count(1) as connectionCount from V$SESSION group by status;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With