START own Service from SQL

  • I have my own service name=[SgDataSrvc] available in the same DB Server machine.

    I opted both options taking [Log On As]=[Local Service] and [Network Service] also.

    Now opening SQL Server2005, applied both ways:

    - SQL Server Authentication [sa login]

    - Windows Authentication

    In the Query tab switched on followings :

    {

    EXEC sp_configure 'show advanced options', 1

    RECONFIGURE

    EXEC sp_configure 'xp_cmdshell', 1

    RECONFIGURE

    EXEC sp_configure 'Ole Automation Procedures',1

    RECONFIGURE

    }

    then executed followings commands :

    EXEC master..xp_cmdshell 'whoami' results [nt authorityetwork service]

    1.declare @ServiceName sysname

    set @ServiceName = 'SgDataSrvc'

    EXEC master.dbo.xp_servicecontrol 'START', @ServiceName

    2.Exec master.dbo.xp_servicecontrol N'START', N'SgDataSrvc'

    3.EXEC master..xp_cmdshell 'sc START SgDataSrvc'--,NO_OUTPUT

    In each case it result >> "Access is denied."

    I am sure it must be possible to start my own service from

    DB Stored Procedure, defintely I will need some right settings.

    Plz give me right direction.

  • think about it and this is painfully obvious 😉

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • It's security related. You are not running the command, the SQL Server service is.

  • It seems 'Local Security Settings' the area to look on, where I have zero idea. Plz put some light on it.

    As my requirement is to provide solution in DB server of SQL 2005 Express, so no SQL-agent there, where I intend to get some time consuming job done parallely in the backend, without stopping the frontend execution thread. So I cretaed seperate window service and was trying to START the service from existing backend stored procedure, hence no need of making changes in the front-end application as well.

  • The SQL Server security service needs rights to start the service. Or a service. This isn't necessarily granted by default. You'd want to set an account for the SQL service that has rights to start the other service. It's not something that the user is involved in (install time or later).

  • Steve, I have no option to reInstall SQL Server into the client sites. Can you give some link over the related topics plz.

  • bravo ! I got the right egg to make the omlett ! MMC !!!

  • STEP1.

    Create a local account (Local Users and Groups, Users). The right-click account, properties, select Member of tab, click Add, type in Administrators, click OK.

    STEP2.

    Start, Control Panel, Administrative Tools, Services, right-click the new service, properties, Log on tab, select this account, type in the local account name (created in STEP1)

Viewing 8 posts - 1 through 7 (of 7 total)

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