SQL.DatabaseReady

Click  here  to download the free SQL.DatabaseReady dependency service.

This service is very useful when you have service(s) that depends on the database being ready before it starts (and it works for Oracle or ODBC databases too).

Normally you would have your service "depend" on the SQL Server (MSSQLSERVER) service. This makes your service wait until all service(s) that it depends upon have started.

But this doesn't always work - especially on some machines with SQL Server 2008 where the MSSQLSERVER service has started but the database recovery process is still busy getting the databases "Online". If you try to connect during this time you will receive an error that the user could access the database (almost seems like a security issue). But after the database is online it works again, problem is that your service as failed to start before the database is online, despite the SQL Server service being started before hand.

This problem is also especially true for some Team System Team Foundation Server (TFS) 2008 SP1 installations running SQL Server 2008 SP1 on a Single-tier deployment model (ATDT). The TFS community suggests that you set your TFS Scheduler service (tfsserverscheduler) to depend on MSSQL (and W3SVC for that matter). Here's the command line to set the dependency on MSSQLSERVER, ReportServer and the web publishing service (W3CSVC):
sc config tfsserverscheduler depend= mssqlserver/reportserver/W3SVC

However, if setting your TFS Scheduler service to depend on MSSQLSERVER (and W3SVC for that matter) is not enough, try putting this SQL.DatabaseReady dependency service in the middle of it all.

Here's how:

  1. 1. Download and install the free SQL.Database dependency service from here
  2. 2. Recommended: Configure the service identity.
    (Using the Services MMC, locate the SQL Database dependency server and set the Logon As to your TFSService identity)
  3. 3. Required: Configure the service with the databases you wish to have it check for connectivity.
    (Edit the SQL.DatabaseReady.exe.config file and update the ConnectionStrings section)
  4. 4. Optional: Configure the service to log activity.
    (Edit the SQL.DatabaseReady.exe.config file and update the TraceListeners section)
  5. 5. Required: Set your TFS Scheduler service (tfsserverscheduler) to depend on the SQL.DatabaseReady service:
    sc config tfsserverscheduler depend= SQL.DatabaseReady


Disclaimer: I cannot and will not take responsibility for any from this suggestion. You are responsible for your backups and recovery of services.

Hope that helps!