We had a problem today on our dev server where a process locked one table, stopping all other queries on that table to work. When running sql_who2 the blkBy columns value was -2, but the -2 was not in the process list.
When running DBCC INPUTBUFFER (-2) I got the exception Invalid SPID -2 specified.
When running beta_lockinfo I see all the tables and indexes it locks, but all other information is null, except that the ownertype was Transaction.
When restarting the webapp(did a change in web.config) the lock dissapered and the same did all the traces of the -2 SPID
My question is why is the SPID a negative value and why can I not get any info about it?
A SPID of -2 represents that your process was blocked by an orphaned distributed transaction.
You can use
KILL 'GUID-OF-THE-UOW'to terminate orphaned distributed transactions, or any other distributed transaction. To do this you’ll need to get the GUID of the Unit of Work (UOW) fromsys.dm_tran_locks.request_owner_guid.-2 is just an artificial association. The session ID of -2 just makes it easier to identify orphaned transactions by querying the session ID column in the dynamic management views.