Solved

Lock_timeout = -1

Posted on 2010-11-11
2
347 Views
Last Modified: 2012-05-10
Current our sql2005 setting has lock time out = -1,, If I increase this values to maybe 2400 will it reduce db deadlock occurrence ?
0
Comment
Question by:motioneye
2 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 250 total points
ID: 34117864
SET LOCK_TIMEOUT allows an application to set the maximum time that a statement waits on a blocked resource. When a statement has waited longer than the LOCK_TIMEOUT setting, the blocked statement is automatically canceled, and an error message is returned to the application.

At the beginning of a connection, @@LOCK_TIMEOUT returns a value of -1.

Examples
This example shows the result set when a LOCK_TIMEOUT value is not set.

SELECT @@LOCK_TIMEOUT
Here is the result set:

----------------
-1
This example sets LOCK_TIMEOUT to 1800 milliseconds, and then calls @@LOCK_TIMEOUT.

SET LOCK_TIMEOUT 1800
0
 
LVL 6

Assisted Solution

by:subhashpunia
subhashpunia earned 250 total points
ID: 34119296
It could resuce the deadlock but not solve your altimate problem because it would cancel more transaction than deadlock.
Better way is to identify the processes that commonly deadlocked. Lock duration is not directly proportional to deadlock (even longer lock duration it increases the probability). So setting the @@LOCK_TIMEOUT does not gaurantee to resolve the deadlock.
To know more about the deadlock error and its fix please check this post:

http://blog.sqlauthority.com/2007/05/16/sql-server-fix-error-1205-transaction-process-id-was-deadlocked-on-resources-with-another-process-and-has-been-chosen-as-the-deadlock-victim-rerun-the-transaction/
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

757 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

23 Experts available now in Live!

Get 1:1 Help Now