-- ===============================================================================
-- Lista a quantidade de sessões por usuário, program, osuser e sql_hash_value.
-- ===============================================================================
select USERNAME, COUNT(USERNAME)
from V$SESSION
group by USERNAME
having COUNT(USERNAME) > 10
order by 2 desc
/
select PROGRAM, COUNT(PROGRAM)
from V$SESSION
group by PROGRAM
having COUNT(PROGRAM) > 10
order by 2 desc
/
select OSUSER, COUNT(OSUSER)
from V$SESSION
group by OSUSER
having COUNT(OSUSER) > 10
order by 2 desc
/
select SQL_HASH_VALUE, COUNT(SQL_HASH_VALUE)
from V$SESSION
group by SQL_HASH_VALUE
having COUNT(SQL_HASH_VALUE) > 10
order by 2 desc
/
select username, program, logon_time, status, floor(last_call_et / 60/ 60) "horas desde Active"
from v$session
where OSUSER='XXXX'
order by last_call_et desc;