Does ServiceController.Stop() stops DB services fully ?

Jun 25 2015 10:08 AM
Hi,
 
 I developed a C# Windows Service for automating backup. In ordered to do full functional backup, i'm using ServiceController method to Stop & Start services. 
 
However I found that couple of files access denied and data base ( Pervasive DB) able to stop but couldnt start.
 
I checked in Stackoverflow and there was comment made in way 2009 

 "ServiceController.WaitForStopped()/WaitForStatus() will return once the service implementation claims it has stopped. This doesn't necessary mean the process has released all of its resources and has exited. I've seen database other than SQL Server do this as well.

If you really want to be sure the database is fully and truly stopped, you will have to interface with the database itself, get ahold of the process id and wait for it to exit, wait for locks on the files to be released, ..." .

So any idea, any response or comments would be appreciated.