Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How to debug timeout/deadlock problems on a table in SQL 2000? Expand / Collapse
Author
Message
Posted Thursday, October 16, 2008 10:22 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Friday, May 28, 2010 9:56 AM
Points: 77, Visits: 248
We are running SQL 2000 on a Win2k3 Server, and think our database might be starting to show some scalability problems.

We have a table that drives a main part of our application. It is inserted and updated a lot. We have seen deadlock errors in the past, and they seem to happen more often in recent months than they had before. Lately, we seem to be experiencing more and more timeout problems involving this table, both on updates and inserts.

We have application error handling that reports us of timeout errors, but I don't ever see anything in the SQL logs. Even the deadlocks don't show up in the SQL logs. Is there a way to log things like this in SQL Server, or any suggestions on tracking down what might be the problem?

Thanks for any ideas!
Post #587133
Posted Thursday, October 16, 2008 11:53 AM
Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Today @ 3:17 PM
Points: 786, Visits: 862
use lock hints and also see if the timeout setting is too low. We ran into this problem where my DB timeout setting was infinite but the application timeout in the ini file was 300 seconds and to our dismay the query takes 600 seconds to do its part from a critical table in the DB, we increased the ini timeout and then never had a problem. Check all the processes that access this table and track down the ones that get deadlocked frequently and try to fix the code...Good Luck!!

The_SQL_DBA
MCTS

"Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives."
Post #587201
Posted Thursday, October 16, 2008 12:33 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 3:40 PM
Points: 30,270, Visits: 23,044
Don't use locking hints, at least not as the first thing you try

Frequent blocking and deadlocks are usually caused by bad code, bad indexes or both. See if you can find what procedures are frequently involved in the blocking and see if you can optimise them.

As for deadlocks, switch traceflag 1204 on (DBCC TRACEON(1204,-1) or -T1204 in SQL's startup parameters). This will result in the deadlock graph been written to the error log. With the deadlock graph, you should be able to pinpoint the cause of the deadlock and fix it. Again, fix the code, tune the indexes.



Gail Shaw
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #587231
Posted Thursday, October 16, 2008 12:57 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Friday, May 28, 2010 9:56 AM
Points: 77, Visits: 248
Thanks! I'll turn the deadlock flag on....I'm pretty sure it's definitely a code and/or index problem (it's a legacy VB6 app I've inherited), but trying to pinpoint where things are happening has been tough. Thanks again for all the help!
Post #587256
Posted Sunday, October 19, 2008 3:05 PM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Tuesday, January 24, 2012 1:24 AM
Points: 456, Visits: 248
You can also add trace flag 1205 along with the 1204 trace flag which will more details about the deadlock..

_____________________________________________

Kindest Regards,
- Tushar
MCP,MCDBA(SQL 2000),MCTS(SQL 2005),MCITP(SQL 2005)

" Most Good Experience Comes From Judgement,
Most Judgement Comes From Bad Experience "
Post #588317
Posted Monday, October 20, 2008 9:47 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 9:43 AM
Points: 3,060, Visits: 4,092
Here is the Bible for deadlock troubleshooting: http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx

Best,

Kevin G. Boles
TheSQLGuru
SQL Server MVP
thesqlguru - gmail
Post #588660
Posted Monday, October 20, 2008 10:34 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 4:40 AM
Points: 6,627, Visits: 7,336
We enable deadlock detection at all our instances using:
startup parameters -T1204 and -T3605
so it gets recorded in the sqlserver errorlog file.

/* to start deadlock detection and recording without stop/start of the instance */
dbcc traceon(1204, 3605, -1)

/*
-- sql-log-info
-- 2006-06-28 14:16:28.00 spid4 KEY: 20:2121058592:3 (5b027ea21b78) CleanCnt:1 Mode: X Flags: 0x0
--
-- key: 20:2121058592:3
-- database 20, object id 2121058592, indid 3
-- select db_name(20) -- = DOrderManagement
Declare @DeadlockKey varchar(128)
Set @DeadlockKey = '20:2121058592:3'

Declare @DbIdNr int
Declare @TbIdNr int
Declare @IxIndIdNr int

Select @DbIdNr = substring(@DeadlockKey,1,convert(int,charindex(':',@DeadlockKey,1)-1))
, @TbIdNr = substring(@DeadlockKey,charindex(':',@DeadlockKey,1)+1, charindex(':',@DeadlockKey,charindex(':',@DeadlockKey,1)+1) - charindex(':',@DeadlockKey,1) - 1 )
, @IxIndIdNr = substring(@DeadlockKey, charindex(':',@DeadlockKey,charindex(':',@DeadlockKey,1)+1) + 1, 25 )

If db_id() = @DbIdNr
begin
select db_name(@DbIdNr) as Deadlock_Database_Name
, object_name(@TbIdNr) as Deadlock_Object_Name
, [name] as Deadlock_Index_Name
, indid
from sysindexes
where id = @TbIdNr
and indid = @IxIndIdNr
order by indid
end else
begin
Select 'USE ' + db_name(@DbIdNr) as Deadlock_Database_Name
end

*/



Johan

Don't drive faster than your guardian angel can fly ...
but keeping both feet on the ground won't get you anywhere

- How to post Performance Problems
- How to post data/code to get the best help


- How to prevent a sore throat after hours of presenting ppt ?


"press F1 for solution", "press shift+F1 for urgent solution"


Need a bit of Powershell? How about this

Who am I ? Sometimes this is me but most of the time this is me
Post #588690
Posted Monday, October 20, 2008 11:20 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 9:43 AM
Points: 3,060, Visits: 4,092
nice little snipped there! ;)

Best,

Kevin G. Boles
TheSQLGuru
SQL Server MVP
thesqlguru - gmail
Post #588717
Posted Tuesday, October 21, 2008 12:43 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 4:40 AM
Points: 6,627, Visits: 7,336
Programming basics : copy/paste :D

DBA basics: script programming



Johan

Don't drive faster than your guardian angel can fly ...
but keeping both feet on the ground won't get you anywhere

- How to post Performance Problems
- How to post data/code to get the best help


- How to prevent a sore throat after hours of presenting ppt ?


"press F1 for solution", "press shift+F1 for urgent solution"


Need a bit of Powershell? How about this

Who am I ? Sometimes this is me but most of the time this is me
Post #588966
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse