sp_whoisactive icon indicating copy to clipboard operation
sp_whoisactive copied to clipboard

'Dormant' should be treated the same as 'sleeping'

Open JC-aus opened this issue 2 years ago • 2 comments

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 +

JC-aus avatar Nov 15 '23 03:11 JC-aus

I agree with you

dbaid avatar Dec 06 '24 09:12 dbaid

+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.

1440x1080 avatar Sep 24 '25 15:09 1440x1080