Solved

an automatic way to detect and report deadlock

Posted on 2014-09-30
14
122 Views
Last Modified: 2015-01-07
Dear all,

right now we have implemented the trace flag 1222 and 1224 for the deadlock detection but it seems that from time to time that SQL didn't handle deadlock in a efficive way, we want to see why!

any better way other than the SQL profiler's deadlock graphic feature, which only on when SQL profile is on and running?

we need a better report on this.
0
Comment
Question by:marrowyung
  • 8
  • 3
  • 2
  • +1
14 Comments
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40351715
Can you confirm which version of SQL Server you have. You have put this under SQL Server 2005 and SQL Server 2008.

If you are using SQL Server 2012, then I would recommend Extended Events.
0
 
LVL 1

Author Comment

by:marrowyung
ID: 40351725
"Can you confirm which version of SQL Server you have"

good question, SQL server 2008 R2 with SP2 + CU4 !

one thing, do you see any CU of that release can handle deadlock better?
0
 
LVL 1

Author Comment

by:marrowyung
ID: 40351726
I need the deadlock event to be report ASAP and know the root cause by that !
0
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 250 total points
ID: 40351732
Whilst Extended Events in SQL Server 2008, it may be a good route to go down.

This web page gives some information: http://blogs.msdn.com/b/sqlserverfaq/archive/2013/04/27/an-in-depth-look-at-sql-server-memory-part-2.aspx

If this solution is not appropriate for your needs, please could you expand on what your needs are.
0
 
LVL 45

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 250 total points
ID: 40351804
one thing, do you see any CU of that release can handle deadlock better?
There's no miracle solution that any DMBS engine will handle a deadlock better. You can have alerts but that will only says you that a deadlock happened and the engine chose a connection as victim and killed the process.

Deadlock it's a clue for bad programming or bad database design model that let's two concurrent transactions performing table actions almost at same time. Search for massive data operations and transactions without a commit or rollback on it.
0
 
LVL 1

Author Comment

by:marrowyung
ID: 40351853
I just read that but I don't see the extended event from "Management" tab, why is it ? any version for SQL server 2008 R2 ?
0
 
LVL 1

Author Comment

by:marrowyung
ID: 40351854
one more question, from that link, what is this for:

Use Master 

SELECT

       xed.value('@timestamp', 'datetime') as Creation_Date,

       xed.query('.') AS Extend_Event

FROM

(

       SELECT CAST([target_data] AS XML) AS Target_Data

       FROM sys.dm_xe_session_targets AS xt

       INNER JOIN sys.dm_xe_sessions AS xs

       ON xs.address = xt.event_session_address

       WHERE xs.name = N'system_health'

       AND xt.target_name = N'ring_buffer'

) AS XML_Data

CROSS APPLY Target_Data.nodes('RingBufferTarget/event[@name="xml_deadlock_report"]') AS XEventData(xed)

ORDER BY Creation_Date DESC

Open in new window


create deadlock report ? in XML ?
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 1

Author Comment

by:marrowyung
ID: 40351858
but that one do not email use the deadlock informaton to us.
0
 
LVL 69

Expert Comment

by:ScottPletcher
ID: 40353251
You can add an Alert to notify you of a deadlock or run a job.  You could have that job notify you and capture data about the deadlock.  I use trace flag 1222 and some code to parse its data, but you could use extended events if you prefer.
0
 
LVL 1

Author Comment

by:marrowyung
ID: 40358906
"but you could use extended events if you prefer"

but I don't see the extend events tab, any idea on my SQL server 2008 R2 ?
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40358909
Unfortunately, it's more complicated in SQL Server 2008 R2 than in SQL Server 2012.

My previous weblink gives you the information: http://blogs.msdn.com/b/sqlserverfaq/archive/2013/04/27/an-in-depth-look-at-sql-server-memory-part-2.aspx
0
 
LVL 1

Author Comment

by:marrowyung
ID: 40358912
I know what you mean, but the Extended events tab in the managment tab don't show up, any idea why ?
0
 
LVL 45

Expert Comment

by:Vitor Montalvão
ID: 40358925
Extended Events tab isn't available in SSMS 2008R2 but there's an add-in from CodePlex if you want to install it.
0
 
LVL 1

Author Comment

by:marrowyung
ID: 40359071
OKOK>

tks but your link doesn't show out why but it also sad working for SQL server 2008 :

"using extended events in SQL Server 2008 and later"

so that's why I am interesting.

but that one don't send our email anyway,

ScottPletcher,

you can show me an example how to make use of the information and sent an email
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now