I'm installing a Windows Service via
The question is, can I set these parameters via commandline so that the database restarts when it happens to fail? I could not find any mention in the docs. Any alternative way is welcome.
You can use the Windows sc command line utility to configure services.
For example, to make restart the action on failure:
sc failure SQLANYs_servicename actions= restart/60000/restart/60000// reset= 240
this will set the failure actions of the database engine service SQLANYs_servicename to re-start after sixty seconds on the first two failures and then do nothing. The reset command re-sets the failure counter after 4 minutes. (NB as Jeff points out the actual service name is "SQLANYs__" in front of whatever you called it!)
You can also use sc config to set things like delayed start-up, service dependencies etc. See sc /? for full details.
answered 15 Sep '12, 08:14
No, there is currently no way to do this using dbsvc. I will add it to my list of features to investigate for a future release.
answered 14 Sep '12, 11:33
There is no current way to control this behaviour via dbsvc.
The service restart parameters are specified in the Registry as the "FailureActions" REG_BINARY value. This information is based on the SERVICE_FAILURE_ACTIONS / SC_ACTION data structures although without investigating further, it's difficult to see how these values are related.
You can try creating a service, manually configure it through the Windows Service manager, and then see if copying the REG_BINARY value to another service definition in the Registry.
The SQL Anywhere registry service information can be found underneath:
Where servicename is the name provided via the "-sn" switch.
You can then apply the registry setting via the "reg" command at the Command Prompt.
answered 14 Sep '12, 11:42