2

I have SQL Server disabled on my machine and have to manually go into services (services.msc) to enable it and the agent. I'd like to write a batch script that I can run to enable them for me. Is it possible? When I do net start in the command prompt I don't see it listed so I'm not sure if it's possible.

EDIT: I'm using Windows Vista. I keep it disabled because having it run all the time slows my comp down and not all my web dev requires it. I'm more productive with it off most of the time because it is so resource intensive, especially for boot time.

3 Answers 3

2

If you set the service to manual, you can create a batch file or two to start and stop it without going into the services menu. The commands would be:

net start SQLAgent$instancename

net stop SQLAgent$instancename

Example would be net start SQLAgent$MICROSOFTSMLBIZ for a BCM instance.

Similar to the agent, the server itself would be:

net start MSSQL$instancename net stop MSSQL$instancename

1

Which operating system?

And why do you keep it disabled?
Shouldn't it be enough to set it to manual startup and then simply start/stop it when needed?

Update

You're confusing "disabled" with "stopped".
If a service is enabled but set to manual startup, it won't start automatically, and it will always stay stopped unless you explicitly start it.
If it's set to "disabled", it will not start ever, and even you will not be able to start it, if you don't change its startup to manual or automatic.

So, just set it to "manual" and start/stop it when needed; it will not be running, unless you ask it to.

0
0

First, I would try to control the memory utilization of the instance (limit it to 75 MB, for example) AND increase the RAM in your computer (Vista is awful about RAM).

Otherwise, I'd go with Dan's suggestion for starting and stopping SQL.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .