-
Notifications
You must be signed in to change notification settings - Fork 76
Resolve blocked processes
Anthony edited this page Jan 15, 2025
·
1 revision
BEGIN
PRINT '====================================================================='
PRINT 'show the blocked process record. '
PRINT '====================================================================='
GO
SELECT
*
FROM
[sys].[dm_exec_requests]
CROSS APPLY [sys].[dm_exec_sql_text]([sql_handle])
WHERE
1=1
AND blocking_session_id != 0;
USE [master];
GO
IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME = 'sp_WhoIsActive')
EXEC sp_WhoIsActive
@find_block_leaders = 1,
@get_plans = 1,
@sort_order = '[blocked_session_count] DESC';
GO
PRINT '====================================================================='
PRINT 'remove the blocked process. '
PRINT '====================================================================='
GO
--KILL 212;
END