熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

Oracle數據庫 監看lock script

2013-11-13 15:50:01  來源: Oracle 

  Script:
  
  SELECT
  SUBSTR(susername) WAITING USER
   SUBSTR(sosuser) OS User
   SUBSTR(TO_CHAR(wsession_id)) Sid
   pspid PID
   SUBSTR(susername) HOLDING User
   SUBSTR(sosuser) OS User
   SUBSTR(TO_CHAR(hsession_id)) Sid
   pspid PID
  FROM
  sysv_$process p
   sysv_$process p
   sysv_$session s
   sysv_$session s
   dba_locks w
   dba_locks h
  WHERE
  hmode_held != None
  AND hmode_held != Null
  AND wmode_requested != None
  AND wlock_type (+) = hlock_type
  AND wlock_id (+) = hlock_id
  AND wlock_id (+) = hlock_id
  AND wsession_id = ssid (+)
  AND hsession_id = ssid (+)
  AND spaddr = paddr (+)
  AND spaddr = paddr (+)
  /
  
  SQL> @locksql
  
  WAITING USER OS User Sid PID
  
  HOLDING User OS User Sid PID
  
  SYS jack
  SYS oracle
  
  可以看出jack user正在等待oracle hold住的鎖
  
  只要oracle user commit/rollback鎖就會解開
From:http://tw.wingwit.com/Article/program/Oracle/201311/17369.html
  • 上一篇文章:

  • 下一篇文章:
  • 推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.