Skip to content

Instantly share code, notes, and snippets.

@rponte
Created September 6, 2010 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rponte/567512 to your computer and use it in GitHub Desktop.
Save rponte/567512 to your computer and use it in GitHub Desktop.
listing and killing oracle sessions
-- comando para listar usuarios conectados no oracle
SELECT s.username, s.program, s.logon_time
FROM v$session s, v$process p, sys.v_$sess_io si
WHERE s.paddr = p.addr(+)
AND si.sid(+) = s.sid
AND s.username = 'MEU_USUARIO';
-- Kill oracle sessions
-- http://www.oracle-base.com/articles/misc/KillingOracleSessions.php
SELECT s.inst_id,
s.sid,
s.serial#,
p.spid,
s.username,
s.program
FROM gv$session s
JOIN gv$process p ON p.addr = s.paddr AND p.inst_id = s.inst_id
WHERE s.type != 'BACKGROUND' AND s.username = 'SYSPDVWEB_TEST';
alter system disconnect session 'sid,serial' IMMEDIATE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment