Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ezhov-da/5f562bdb401ffe961839d91243da6b0e to your computer and use it in GitHub Desktop.
Save ezhov-da/5f562bdb401ffe961839d91243da6b0e to your computer and use it in GitHub Desktop.
Отображение и разрыв сессий
-- https://stackoverflow.com/questions/1043096/how-to-list-active-open-connections-in-oracle
-- https://oracle-base.com/articles/misc/killing-oracle-sessions
select
'ALTER SYSTEM KILL SESSION ''' || b.sid ||',' ||substr(b.serial#,1,5) || ''' IMMEDIATE;' as query,
substr(a.spid,1,9) pid,
substr(b.sid,1,5) sid,
substr(b.serial#,1,5) ser#,
substr(b.machine,1,6) box,
b.username as username,
b.server,
substr(b.osuser,1,8) os_user,
substr(b.program,1,30) program
from v$session b, v$process a
where
b.paddr = a.addr
and b.USERNAME='USERNAME'
order by spid;
ALTER SYSTEM KILL SESSION '649,46943' IMMEDIATE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment