Solved

The deadlock flag ;-T1204;-T1222

Posted on 2013-05-24
12
1,902 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel conversion issue with Sql server 14 54
SQL Statement to Update Email Domain 2 30
SQL Pivot Rows To Columns 10 53
SQL query with cast 38 42
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

770 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