'Dormant' should be treated the same as 'sleeping'
The show_sleeping_spids flag is intended to show connections that are not performing any sql activity or holding any resources. 'Dormant' is the same as "sleeping", except a "DORMANT" SPID was reset after completing an RPC event from remote system (possibly a linked server). This cleans up resources and is normal; the SPID is available to execute.
CASE @show_sleeping_spids
WHEN 0 THEN
'AND not sp0.status in (''sleeping'',''dormant'')
'
WHEN 1 THEN
'AND
(
not sp0.status in (''sleeping'',''dormant'')
OR sp0.open_tran_count > 0
)
'
ELSE
''
END +
I agree with you
+1, I've modified the procedure on my servers.
This is very frustrating, I have a BAG - primary, secondary + DR server in log shipping configuration. I've implemented dbatools for Job syncing and i used linked server connections as a way to know which server the job is currently running on and if the DR server is currently active. So basically there are non-stop small linked server queries which leave behind like ~30 dormant sessions on all servers. I don't want to see them.