Script for Oracle Database session,user,process and sid details.
col OS_USER for a25
col SID for a10
col USERNAME for a20
col PID for a20
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;
————–Active session count details————–
select distinct osuser, count(osuser) as active_conn_count
from v$session
group by osuser
order by active_conn_count desc