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.
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.