oracle鎖會話

chenfengwww發表於2012-03-18

SQL> select * from dba_waiters;

set linesize 200


1.檢視鎖會話情況
select sid,addr,type,lmode,request from v$lock where request>0 and type <> 'MR'


得到sid

2.檢視等待會話、狀態和等待時間
col event for a20
col p1text for a20
col p2text for a30
select sid,event,p1text,p2text,state,seconds_in_wait from v$session_wait where sid=

3.檢視會話資訊
select sid,serial#,username,program,terminal from v$session where sid=

4.檢視會話詳細
select sql_text from v$sql where address in ( select sql_address from v$session where sid= )

5.作業系統後臺kill掉對應程式
select spid from v$process where addr in (select paddr from v$session where sid= )

host kill -9 spid

直接殺死153會話,方法如下:
> alter system kill session '153,18219'; ——'sid,serial#'

[@more@]

========================================
update 行級鎖
select addr,xidusn,xidslot,xidsqn from v$transaction;
select xidusn,xidslot,xidsqn,object_id,session_id, oracle_username from v$locked_object;
select addr, sid, type, id1,id2,lmode, request, block from v$lock where sid=1243;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22036495/viewspace-1057622/,如需轉載,請註明出處,否則將追究法律責任。

相關文章