Newbie: NET STOP - Command Window Error

  • Hello. I was asked to troubleshoot the following problem, but have had little luck - hope you can help:

    I have a server that has several (15 or so) open/cascaded command windows, all with the following error message displayed:

    Title Bar: WINNT\System32\MSTASK.exe

    >NET STOP SQLSERVERAGENT

    The service could not be controlled in its present state.

    more help is available by typing NET HELPMSG 2189

    The following services are dependent on the MSSQLSERVER service. Stopping the MSSQLSERVER service will also stop these services.

    SQLSERVERAGENT

    Do You wish to continue? [Y/N]

    Any ideas on why the MSTASK.exe program keeps erroring out like this? Why is it stuck in a partially running state? What causes that? Any help you can give would be most appreciated.

    FYI: Windows 2000 Server 5.00.2195 SP2/ SQL Server 2000 SP2 & IE 5.00.3315.1000 (SP2)

    Thanx in advance!

    jmonty

  • Is the MSTASK.exe from the Task Scheduler? I believe it is, but not 100%. It looks like it is erroring, but also prompting (this is why it is hanging).


    "Keep Your Stick On the Ice" ..Red Green

  • Stop the dependent service(s) first. Once all of the dependent services are stopped, you should be able to stop mssqlserver without the additional "Do You wish to continue?" prompt.

  • what about using

    exec xp_servicecontrol 'stop', 'SQLSERVERAGENT'

    Frank

    http://www.insidesql.de

    http://www.familienzirkus.de

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • mstask.exe *is* the windows task scheduler. I am 100% sure.

    Apparently there is a schedule that runs runs "net stop mssqlserver"

    Every time this task runs you get another windows.

    (maybe as part of a backup procedure - in that case you have missed lots of backups).

    Check the scheduler what is supposed to be happening.

  • I dug a little deeper. There are several schdeuled tasks that run daily. Each scheduled task runs a different NT .cmd file. Within all these files are a simple copy file command then the following:

    NET STOP SQLSERVERAGENT

    NET STOP SQLSERVER

    NET START SQLSERVER

    NET START SQLSERVERAGENT

    They appaer to be in the correct order, but they seem to be executing the next command before waiting for the last service to stop.

    Is there a way to pause (without prompting - these need to run unattended) until the service has stopped, or is there a way to check if it is stopped?

    What's my next step? TIA

  • On NT and Windows 2000 you can use start /wait. (On Windows 2003 that is the default.) It is meant for windows programs, not command line programs and I thought net was commandline

    That would be

    start /wait NET STOP SQLSERVERAGENT

    start /wait NET STOP SQLSERVER

    start /wait NET START SQLSERVER

    start /wait NET START SQLSERVERAGENT

    Another possibility is that the stopping process takes longer than the program expects.

    I do not know how to set the time for SQLServer. Maybe someone else does.

    If this does not work, there is a sleep program in the Windows resource kit that you could use to sleep between the net command.

    Edited by - joachim.verhagen on 11/19/2003 09:24:57 AM

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

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