Querying and terminating database sessions |
Query sessions
The system view to query is: v$session
set lines 180 pages 180
col machine for a30
select count(*), upper(PROGRAM), machine from v$session where
type='USER' group by machine, upper(PROGRAM) order by 1 desc;
Kill database sessions
1) Identify the SID and SERIAL# for the
session you want to terminate:
select status, sid,
serial#, username, machine, program from v$session;
2) Then run the following from sqlplus as sys or system:
alter system kill session 'SID,SERIAL#';
Example:
SQL> alter system kill session '112,34224';
Sometimes it comes back as session
marked to kill. Wait until oracle
cleans up the session or if you are not
patient kill the OS process too.