Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure SQL: Negative SPID = -5

i have AzureSQL database (Provisioned - 2vCore, General Purpose) and sometimes my queries are blocked by session with SPID = -5.

I didnt find anything about this negative SPID and how to avoid blocking my queries.

Thanks for any info and help

like image 205
Milan Labanc Avatar asked Aug 27 '26 11:08

Milan Labanc


1 Answers

Sessions with negative SPID are probably orphaned transactions. You cannot kill the session using KILL command as it needs a positive SPID number. Try running below query on the Azure SQL Database:

SELECT 
    DISTINCT(request_owner_guid) as UoW_Guid
FROM sys.dm_tran_locks
    WHERE request_session_id =-5
GO

This should return a GUID like with the following format: 00000000-0000-0000-0000-000000000000

Try to kill the session using the GUID instead of the SPID as shown below:

KILL '00000000-0000-0000-0000-000000000000' -- replace GUID value with UoW_Guid value from above query
like image 131
Alberto Morillo Avatar answered Aug 30 '26 12:08

Alberto Morillo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!