SQL Server 2008 R2 – Session_id: Negative Number

sql-server-2008-r2t-sql

Today, while monitoring my data base I see an special session_id with negative number. (-4)

enter image description here

Anyone would help me to understand what do it please?

Best Answer

Per BOL:

blocking_session_id
ID of the session that is blocking the request. If this column is NULL, the request is not blocked, or the session information of the blocking session is not available (or cannot be identified).
-2 = The blocking resource is owned by an orphaned distributed transaction.
-3 = The blocking resource is owned by a deferred recovery transaction.
-4 = Session ID of the blocking latch owner could not be determined at this time because of internal latch state transitions.

I did a write up on it here. However the simple way to get rid of it

I wasn't able to find a whole lot of information on -4 spids. Everything I was able to find sounded like a tempdb issue. This is the solution I use to get rid of -2s but it should work for you:

 SELECT request_owner_guid
 FROM sys.dm_tran_locks 
 WHERE request_session_id = -4

Take each row from the result and use it to create a KILL statement.

KILL 'D21D8DAB-C75C-411A-879B-FFDE10E3F397'

Be warned however we do have a system that gets -2s (I know that's different but even so) on a regular basis and if you kill them it can cause problems with the system. If this is the only time you've seen it I think you'll be fine though.