透過 extended event 查 Dead lock

最近似乎常查 SQL 2008 後 Deadlock 的問題,將語法放這,容易共享

select c.query(‘.’) xmlData,
c.value(‘(./@name)[1]’,’varchar(50)’) name,
c.value(‘(./@id)[1]’,’varchar(50)’) id,
c.value(‘(./@timestamp)[1]’,’datetime’) timestamp,
c.value(‘(./data/value)[1]’,’varchar(50)’) value
from
(select CAST(target_data as XML) errEvent
from sys.dm_xe_session_targets dxst where target_data is not null
) t cross apply
errEvent.nodes(‘//event[@name="xml_deadlock_report"]’) n(c)

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s

%d 位部落客按了讚: