Solved

The deadlock flag ;-T1204;-T1222

Posted on 2013-05-24
12
2,016 Views
Last Modified: 2013-05-29
Dear all,

Right now I would like to turn on the deadlock trace flat for the MS SQL server 2008 R2 by add ;-T1204;-T1222 to the end of the SQL server startup parameter.

Any one know if this SQL server is clustered, I need to modify the start up parameter of SQL server service  on both nodes?

Of course I need to stop the SQL server services from the failover manager.
0
Comment
Question by:marrowyung
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
12 Comments
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 500 total points
ID: 39193666
Instead of changing it at the Startup parameter, you can add the flag internally by using the below commands:

DBCC TRACEON (1222, -1);
DBCC TRACEON (1204, -1);

To disable the trace flag, you can use the below command.

DBCC TRACEOFF (1222, -1);
DBCC TRACEOFF (1204, -1);
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 39193673
Missed mentioning this, if you want to add it as a startup parameter, then you need to do it on both nodes..
0
 
LVL 1

Author Comment

by:marrowyung
ID: 39193804
Dear rrjegan17,

someone tell me that if I do this:

Instead of changing it at the Startup parameter, you can add the flag internally by using the below commands:

DBCC TRACEON (1222, -1);
DBCC TRACEON (1204, -1);

To disable the trace flag, you can use the below command.

DBCC TRACEOFF (1222, -1);
DBCC TRACEOFF (1204, -1);

then whenever the SQL server restart, then this flag lost ? that's why I want to enalbe it as startup parameter..
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 39193821
No, if you have -1 in the DBCC TRACEON statement. -1 indicates that the trace flag is enabled globally.
If you don't have -1, then it indicates that the trace flag is enabled for your session alone and will lose it after the session is closed.
And all the trace flags enabled with DBCC TRACEON will get disabled only after we run DBCC TRACEOFF statement.
0
 
LVL 1

Author Comment

by:marrowyung
ID: 39193836
so if we do this:

DBCC TRACEON (1222, -1);
DBCC TRACEON (1204, -1);

This will turn on both flag globally for that SQL instance and no matter that SQLserver restarted, the option still there? all deadlock information will be save in SQL server log ?

And if we do in this way, then we don't need to restart the SQL server service at all? and we just need to run it on that instance even it is clustered ?
0
 
LVL 1

Author Comment

by:marrowyung
ID: 39193853
T1222

"Returns the resources and types of locks that are participating in a deadlock and also the current command affected, in an XML format that does not comply with any XSD schema.

Scope:global only
"

it will return an XML files for us? where will it store this XML file ?
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 39193854
>> This will turn on both flag globally for that SQL instance and no matter that SQLserver restarted, the option still there? all deadlock information will be save in SQL server log ?

Yes, it will be enabled globally for that SQL instance and deadlock information will be stored in SQL Server error log.

>> And if we do in this way, then we don't need to restart the SQL server service at all? and we just need to run it on that instance even it is clustered ?

No need to restart SQL Server service if it is done via DBCC TRACEON.
And it will work even if instance is clustered.
If you are having doubt, then check the status of trace flags by running

DBCC TRACESTATUS(1222,-1);
DBCC TRACESTATUS(1204,-1);

But if you are trying to add startup parameter, then you need to do it in both nodes.
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 39193859
>> it will return an XML files for us? where will it store this XML file ?

Yes, XML content will be written in SQL Server error log.
For 1204, it will be a readable format.
0
 
LVL 1

Author Comment

by:marrowyung
ID: 39193885
"Yes, XML content will be written in SQL Server error log."

then we can understand the XML format ? or that XML format alreayd rendered for us ?
0
 
LVL 1

Author Comment

by:marrowyung
ID: 39193903
so basically it will not enlarge the SQL server log dynamically ?

what is your experience in your case ?
0
 
LVL 1

Author Comment

by:marrowyung
ID: 39193923
that one is the one store in \MSSQL10_50.MSSQLSERVER\MSSQL\Log\ERRORLOG?
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 39193938
yes, it will capture deadlocks into the above file.
And the amount of log file growth really depends upon the no. of deadlocks you are encountering.
Also the no. of deadlocks happening on the system indicates the quality of code written by your application team. If more no. of deadlocks, then there is some logic issue with Application code or logic.
0

Featured Post

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

691 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