1. 程式人生 > >查詢死鎖的Session SQL 語句

查詢死鎖的Session SQL 語句

RM sql 語句 cts blog ble pid cer eight pan

/* Formatted on 2018/3/14 23:34:49 (QP5 v5.256.13226.35538) */

SELECT dob.object_name table_name

, lo.locked_mode

, lo.session_id

, vss.serial#

, vps.spid

, vss.action action

, vss.osuser osuser

, vss.process ap_pid

, vps.spid db_pid

, ‘alter system kill session ‘ || ‘‘‘‘ || lo.session_id || ‘,‘ || vss.serial# || ‘‘‘;‘ kill_command

FROM v$locked_object lo

, dba_objects dob

, v$session vss

, v$process vps

WHERE lo.object_id = dob.object_id

AND lo.session_id = vss.sid

AND vss.paddr = vps.addr

/* AND dob.OBJECT_NAME like ‘AP_%‘ */

/* AND vss.client_info like ‘OU_ID%‘ --OU_ID:就是指所在企業的OU的ID*/

ORDER BY 2, 3, dob.object_name;

查詢死鎖的Session SQL 語句