-- =======================================================================
-- Finding stale sessions
-- =======================================================================
select sid, serial#, username, last_call_et
from v$session
where username is not null;
SID SERIAL# USERNAME LAST_CALL_ET
--- ------- -------- ------------
14 655 HR 0
98 875 CRM 1
32 455 CRM 3
45 165 HR 36
112 592 SYSTEM 160
119 981 CULPADO 36522
65 234 CULPADO 743160
ALTER SYSTEM KILL SESSION ‘65,234’;
System altered.
-- =======================================================================
-- Policing for login abuse and unauthorized logins
-- um usuario passou a senha para outro logar USERNAME / OSUSER
-- =======================================================================
select sid, serial#, username, osuser, program
from v$session
where username is not null;
SID SERIAL# USERNAME OSUSER PROGRAM
------- ---------- -------- ------- -----------------
112 3741 CULPADO CULPADO sqlplusw.exe
122 3763 CULPADO RKHAN sqlplusw.exe
115 9853 SYSMAN oracle OMS
122 35878 HR HRAPP sqlplus@classroom
124 4 DBSNMP oracle emagent@classroom