Daily Archives: March 29, 2012
This is a question I received from a new SQL Server DBA so I thought it would make a great blog topic. Blocking occurs in SQL Server when one process has one (or more) of the records locked and another process tries to acquire a lock on the record. This will subsequently cause the process to wait until the original process is done so that it can acquire the record. This can cause a domino effect if subsequent processes are waiting for the new process to be done with the records it is holding. Blocking is somewhat different from the fatal deadlock which SQL Server handles and stops automatically (and a block can become a deadlock but this a different case).
The blocked process essentially must wait and that can be a problem for your database! I have previously blogged about best practices for separating our your log files to another drive as well as system databases and tempdb. If you are not following these best practices, then they may play into your blocking situation as well as inadequate hardware for your SQL Server.
Ok, how do I see those blocked processes?
One way is some code I found at CodeProject: List blocking processes in SQL server – CodeProject®.
Or, two days ago I wrote a blog talking about the newest release of Adam Machanic’s Who is Active stored procedure.
Below I have listed a couple of links for more information on how to use this procedure.
Thanks, Adam! Enjoy!