You are on page 1of 1

Database blocking occurs when a connection to the SQL server locks one or more records,

and a second connection to the SQL server requires a conflicting lock type on the record, or
records, locked by the first connection. ... A certain amount of blocking is normal and
unavoidable.

There are number of ways to find out the details of the system processes IDs (spids)
involved in blocking

 sp_who2 System Stored Procedure


USE Master
GO
EXEC sp_who2
GO

 sys.dm_exec_requests DMV
USE Master
GO
SELECT *
FROM sys.dm_exec_requests
WHERE blocking_session_id <> 0;
GO

 Sys.dm_os_waiting_tasks
USE Master
GO
SELECT session_id, wait_duration_ms, wait_type, blocking_session_id
FROM sys.dm_os_waiting_tasks
WHERE blocking_session_id <> 0
GO

 SQL Server Management Studio Activity Monitor


 SQL Server Management Studio Reports
 SQL Server Profiler

Deadlock :
A deadlock occurs when two or more processes are waiting on the same resource and each
process is waiting on the other process to complete before moving forward.  When this
situation occurs and there is no way for these processes to resolve the conflict, SQL Server
will choose one of processes as the deadlock victim and rollback that process, so the other
process or processes can move forward.

You might also like