Skip to content

Instantly share code, notes, and snippets.

@kbaesler
Last active January 7, 2019 22:44
Show Gist options
  • Save kbaesler/a23c306622e6167f0300f75d406ac0ea to your computer and use it in GitHub Desktop.
Save kbaesler/a23c306622e6167f0300f75d406ac0ea to your computer and use it in GitHub Desktop.
HOW TO FIND STALE SESSIONS IN ORACLE 12C
--
-- To get a list of logged-in users and the last time they issued a command, connect to the database as a DBA user
--
select S.USERNAME,
S.MACHINE,
S.OSUSER,
S.PROGRAM,
S.SID,
S.SERIAL#,
P.SPID,
S.LAST_CALL_ET as LAST_TIME_ACTIVE
from V$SESSION S,
V$PROCESS P
where S.PADDR = P.ADDR
and S.USERNAME is not null
order by S.USERNAME, LAST_TIME_ACTIVE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment