Restart service on remote app after SQL Cluster failover

  • I need to be able to restart an application service after the SQL Cluster fails over. Any suggestions on how to accomplish this as a SQL job?

  • I recommend you do not use a CMDEXEC job step to issue a NET START, because doing so would require the SQL Server Agent startup account to gain elevated permissions.

    Instead, I recommend you use sc.exe https://technet.microsoft.com/en-us/library/bb490995.aspx to create a dependency upon MSSQLSERVER (or whatever ServiceName your clustered instance of SQL Server uses).

    If this dependent service is failing to start because it attempts to connect to a database that has not yet recovered (and the service incorrectly stops attempting to use the database after a fixed or short interval of time), consider using sc.exe's FailureActionsAndDelayTime. Using sc's delay time could give you enough time to fix the service's code (instead of punting the problem to a process that is designed to support the recovery of a partially-written file). If the service is also clustered (hopefully not in SQL Server's cluster group), also consider tweaking its cluster configuration.

    One further reason to avoid using a job is that msdb could have recovered, while the application's database has not yet recovered, in which case the job's attempt to start the service would (if I am correctly guessing about the need behind your ask) still result in the service failing to start... And the opposite is possible (msdb recovers more slowly than the application's database, or worse still, msdb goes suspect), in which case the job would not help...

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

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