Start up service based on SQL

  • Is there a way to start up a service after I start SQL Server?

    One of our services is dependent on SQL. When I reboot the box the service tries to connect to SQL. If SQL is not ready to accepts connection at that time the service errors out and does not restart. Can I setup a proceudre to run everytime SQL Server restarts. And have that procedure do some sort of xp_cmdshell that starts the service or sends a net send command to start the service.

     

    Thanks

    -WM

  • Hi Will,

    You can set up a service dependency (http://support.microsoft.com/kb/193888) - you should make sure that you check the restart options etc via the services control panel once you have set up the dependency.

    - James

    --
    James Moore
    Red Gate Software Ltd

  • You can use system procedure sp_procoption (@sp_name)

    where @sp_name is stored procedure name that server will start right after the reboot. You can put your xp_cmdshell commend in that stored procedure.

     

  • thanks for you help guys

     

    Creating the procedure and using xp_cmdshell worked perfect.

     

    Thanks again

    -WM

    DBA

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply