How to detect that the SQLServer is shutting down i.e Shut down in Progress

  • I have a service that monitors SQL Server's always on Group status. When I bring down my SQL Server setup for planned downtime testing, my application keeps getting errors as follows

    "SHUTDOWN is in progress. (Err:6005, State:2 Severity:14); "

    I do not see this error in my monitoring script, so the monitoring service feels everything is ok.

    Is there a way where I can detect that the Shutdown has started on the server by using TSQL.

  • if the service is shutting down scripts will not be running.

    What you could do is run a SP at each service start, or capture the service state from the Windows OS, maybe using PowerShell

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply