Oracle

오라클 Session Kill

한준_희아빠 2008. 5. 29. 10:58

LOCK 확인
SELECT * FROM V$LOCKED_OBJECT

세션확인
SELECT
SID, SERIAL#, USERNAME, STATUS
FROM V$SESSION

세션 KILL
ALTER SYSTEM KILL SESSION 'SID,serial number'

예제
ALTER SYSTEM KILL SESSION '41,2143'

세션이 안죽는 경우 아래와 같이 쿼리를 날려 unix pid 를 알아낸후
select p.spid,
p.terminal,
p.program,
p.background,
s.*
from v$process p,
v$session s
where p.addr = s.paddr

UNIX 인 경우
ps -ef || grep ora

-- pid 확인후
kill -9 pid

WINDOW 인 경우

orakill sid thread

예를들어
D:\oracle\ora81\bin>orakill ORA8I 1020

여기서
sid = the Oracle instance to target
thread = the thread id of the thread to kill

thread 는 아래 쿼리의 spid 임.
select
p.spid,
p.terminal,
p.program,
p.background,
s.*
from v$process p,
v$session s
where p.addr = s.paddr