on 2012 Sep 14 10:59 AM
I'm installing a Windows Service via dbsvc
command that starts our database. This works fine however, when the dbsrv12
process is killed from the task manager (for testing purposes:), it doesn't restart. To solve this, I have to go to Windows' "Services" list and set the "First failure" action on the "Recovery" tab to "Restart the Service" (which was "Take No Action"), which makes the command line installation somewhat pointless.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
\\\\HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\services\\SQLANYs_servicename
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
71 | |
11 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.