Solved

The deadlock flag ;-T1204;-T1222

Posted on 2013-05-24
12
1,864 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
  • 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
 
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Truncate vs Delete 63 88
Need help with a query 6 55
Convert column to int 13 27
How to Install SSIS without the SQL Server CD 3 17
Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

758 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