광고 한 번씩 클릭해 주시면 글 쓰는데 큰 힘이 됩니다 (제발~)

IT/Databases

oracle procedure lock 오라클 프로시저 행 or 락 걸렸을 경우 처리 방안

BradKim81 2021. 4. 30. 18:11
728x90

요렇게 

 

select a.sid, a.serial# ,a.status
from v$session a, v$lock b, dba_objects c
where a.sid=b.sid and
b.id1=c.object_id and
b.type='TM' and
c.object_name = 'table_name'

 

또는 요렇게 찾고

 

select sid,
substr(rawtohex(p1),1,30) a,
substr(rawtohex(p2),1,30) b
from v$session_wait where wait_time=0 and event like 'library cache pin%'

 

알아내서

 

select sid, serial# from v$session where sid = '1023'

 

죽인다

 

alter system kill session '1023,18985'

 

320x100

 

참고로 위에 찾고에서 조회가 안되는 놈들이 있다.

이럴때는 직접 자신이 실행한 작업을 직접 찾는다~

 

SELECT   distinct a.sid,  a.serial#,
  a.machine,  a.terminal,  a.program,
  b.address,  b.piece,  b.sql_text
FROM   v$session a,  v$sqltext b
WHERE   a.sql_address = b.address
and MACHINE = 'bradkim-PC'
order by a.sid, a.serial#,b.address,b.piece

 

그리고 찾은 SID를 직접 죽인다

(참고로 난 두번째걸로 해서 해결)

320x100