Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

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.

asked 14 Sep '12, 09:59

henginy's gravatar image

accept rate: 0%

edited 14 Sep '12, 10:06

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.

permanent link

answered 15 Sep '12, 08:14

Justin%20Willey's gravatar image

Justin Willey
accept rate: 20%

One thing to note is that the positioning of the equals signs is vital. There must be no space between the keyword (eg "actions" or "reset") and the equals sign, and there must be a space after the equals sign.

(17 Sep '12, 07:34) Justin Willey

Using 'sc' solves it, thanks.

(19 Sep '12, 10:52) henginy

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.

permanent link

answered 14 Sep '12, 11:33

Graeme%20Perrow's gravatar image

Graeme Perrow
accept rate: 54%

Thanks. It's not critical since there's a way around, but might be easier with a switch=)

(19 Sep '12, 10:59) henginy

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.

permanent link

answered 14 Sep '12, 11:42

Jeff%20Albion's gravatar image

Jeff Albion
accept rate: 25%

I think sc command does necessary updates to the registry. Thanks for the answer.

(19 Sep '12, 10:52) henginy
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 14 Sep '12, 09:59

question was seen: 22,739 times

last updated: 19 Sep '12, 10:59