Solved

The deadlock flag ;-T1204;-T1222

Posted on 2013-05-24
12
1,974 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 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