I have some Windows services that I'd like to restart after a database failover but I can't find any details on triggering external actions after a failover. I'm working with SQL Server 2012 database mirroring.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
For a cluster failover you can use a startup procedure. Assuming you have xp_cmdshell enabled and the service account has adequate permissions to start services:
I blogged about this for different reasons here:
You could also not use the startup option and instead just call the stored procedure from a job, and schedule the job to run when SQL Server Agent starts:
Of course this depends on the SQL Agent service starting successfully, and also assumes that the Agent or SQL Server services do not depend on the service you're trying to start. :-)