본문 바로가기

DATABASE

[ORACLE] lock 걸린 테이블 및 유저찾기

column username format a10
column lockwait format a10
column sql_text format a80
column object_owner format a14
column object format a15
select b.username username, c.sid sid, c.owner object_owner,
c.object object, b.lockwait, a.sql_text SQL
from v$sqltext a, v$session b, v$access c
where a.address=b.sql_address
and a.hash_value=b.sql_hash_value
and b.lockwait = 'WAIT'
and b.sid = c.sid
and c.owner != 'SYS';