Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Need Help.

Author  Topic 

tooba
Posting Yak Master

224 Posts

Posted - 2013-04-12 : 01:22:52
Hi Guys,

I need help.

I have few questions.

1) Let say if i am running any query
E.G select * from table1 and its taking to long to execute it and i stop the query
did this step cause table dead lock problem?

2) when you execute sp_who and if status = runnable, what do you think, did this
causing table dead lock error.

I know how dead lock happend.

3) Is there any query to find out which table has dead lock?

Any help would be great appreciate.

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-04-12 : 01:54:53
By using SQL Profiler, you can get to know the details
http://www.mssqltips.com/sqlservertip/2130/finding-sql-server-deadlocks-using-trace-flag-1222/

http://www.intertech.com/Blog/Post/SQL-Server-Deadlocks-Caused-By-Clustered-Index-Scan.aspx
Go to Top of Page

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2013-04-12 : 10:12:01
assuming that you know about what is deadlock or how it occurs.

by default, when a deadlock occurs, SQL server kills (and rollback) one of the process automatically with a message. And the other one is executed.

So to your questions

1) If your query took considerably longer than normal execution time and you stop it explicitly, then most likely it would be a locked situation instead of a deadlock. since as I mentioned deadlocked situation is handled by SQL server automatically.

2) I would rather like you to refer towards BOL to find out the exact meaning of each column's value. In your case, blkBy information will tell you whether the process is, blocking/blocked by some, other process.

3) In addition to the @bandi's two references, you may like to have go through the extended events, reading SQL server error log files.

Cheers
MIK
Go to Top of Page
   

- Advertisement -