HOW TO: Fix an SQL Server Deadlock?

Published on
3,139 Points
Last Modified:
Avis Moonsamy
Technical Expert and Passionate Nature Photographer
During the weekend, I was asked to investigate into a deadlock in SQL Server 2014. SQL being something I don’t really fancy myself being an expert at, I had to do some refreshing. This article is a collection of my notes.

What is a deadlock?

Basically, it is a  conflict in which one process is waiting for another to release a resource. This is also known as a block. Although in SQL Server a blocked process usually resolves itself when the first process releases the resource but there are times when a process holds a transaction lock and doesn’t release it.

This can be a serious condition, not just for SQL Server as processes become suspended, but for the applications which rely on SQL Server as well.

How to Fix it?

To fix this issue, we will use the Activity Monitor to identify the blocking process and then if possible kill it.

Activity Monitor is a tool in SQL Server Management Studio that gives you a view of current connections, processes, and locks held on SQL Server resources.

To open Activity Monitor in SQL Server Management Studio, right-click the SQL Server instance name in Object Explorer and then select Activity Monitor.

To find a blocked process with Activity Monitor, expand Processes in Activity Monitor to view more details about the processes.

Next step is to identify the process that is waiting. To do this, click on the Blocked By tab. This will sort by the column and show you all the blocked processes.

To stop the blocking process, right-click it and choose Kill Process.

If the blocking process is not eliminated by using the Kill Process, your last resort will be to restart the server. A restart of the SQL Server will clear all blocking processes.


Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Join & Write a Comment

Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month