dbms:mssql:admin:waitevent
MS-SQL Event 조회
현재 wait event 조회
SELECT req.session_id
,blocking_session_id
,ses.host_name
,DB_NAME(req.database_id) AS DB_NAME
,ses.login_name
,req.status
,req.command
,req.start_time
,req.cpu_time
,req.total_elapsed_time / 1000.0 AS total_elapsed_time
,req.command
,req.wait_type
,sqltext.text
FROM sys.dm_exec_requests req
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext
JOIN sys.dm_exec_sessions ses
ON ses.session_id = req.session_id
WHERE req.wait_type IS NOT NULL
--WHERE req.wait_type = '?'
현재 실행중인 SQL 조회
SELECT /* MONITOR */ s2.text,
session_id,
start_time,
STATUS,
cpu_time,
blocking_session_id,
wait_type,
wait_time,
wait_resource,
open_transaction_count
FROM sys.dm_exec_requests a
CROSS APPLY sys.dm_exec_sql_text(a.sql_handle) AS s2
WHERE STATUS <> 'background';
dbms/mssql/admin/waitevent.txt · 마지막으로 수정됨: 2016/09/06 14:26 저자 starlits