SQL SERVER – 2005 – Start Stop Restart SQL Server From Command Prompt

Very frequently I use following command prompt script to start and stop default instance of SQL Server. Our network admin loves this commands as this is very easy.

Click Start >> Run >> type cmd to start command prompt.

Start default instance of SQL Server
net start mssqlserver
SQL SERVER - 2005 - Start Stop Restart SQL Server From Command Prompt netstart

Stop default instance of SQL Server
net stop mssqlserver
SQL SERVER - 2005 - Start Stop Restart SQL Server From Command Prompt netstop

Start and Stop default instance of SQL Server.
You can create batch file to execute both the commands together.
SQL SERVER - 2005 - Start Stop Restart SQL Server From Command Prompt netstartstop

Reference : Pinal Dave (https://blog.sqlauthority.com)

SQL Scripts, SQL Utility
Previous Post
SQL SERVER – UDF – User Defined Function – Get Number of Days in Month
Next Post
SQLAuthority News – Job Opportunity in Ahmedabad, India to Work with Technology Leaders Worldwide

Related Posts

114 Comments. Leave new

  • I mistakenly stopped mssqlserver using configuration manager that caused to stop mssqlagentservice as well. When I followed ur instruction as mentioned above from command, then that prompt always says “Access Denied”. What shall I do?

    Reply
    • The same error came to me as well, and I found out that the Command Prompt was not running with elevated priviliges, so i again started the CMD with “Run as Administrator”, and it start working then.

      Reply
  • Hi ,

    I am trying to start the sql server agent but giving error .

    The error is :

    The sqlagent service on local computer started and then stopped. some services stop automatically if they have no work to do, for example, performance logs and alerts service

    Please some one help me…

    Thanks & Regards ,
    Sahasra

    Reply
  • this article was really helped me. Thank you very much

    Susantha

    Reply
  • Trying to write a script that will do the following:

    1. START MSSQLSERVER
    2. START SQLSERVERAGENT
    3. Restore database over existing database with overwrite existing option selected.
    4. STOP MSSQLSERVER
    5. STOP SQLSERVERAGENT

    Any thoughts?
    brad

    Reply
  • I have SQL Server 2005. It is stopped and I can not start it again.
    I have tried to start it:
    1. through SQL Server Configuration Manages (/services/SQL Server (SQLEXPRESS) by double click.
    2. through SQL Server Configuration Manages
    (/services/SQL Server (SQLEXPRESS) right click /start .
    3. changing the Built-in account to Local System and also to Network Services
    but nothing!!!

    I have run your proposal : “net start mssqlserver” but i have the following message:
    “The specified service name is not valid. You can have more help by typing NET HELPMSG 2185”

    Sobody told me that there might be a confict with other programs. Is this meaningful to you?
    So… I have disabled the F-Secure antivirus but nothing changed.

    Is there anyone that can help me?
    Full of expectations…
    Despina

    Reply
  • Dev
    We have a problem of not starting SQL Server service at start up of windows though it was set up to start automatically under win services.

    So is there a way i can you the script as above to check is SQL server service has started successfull after reboot if not try attempting using the above script.

    Thanks

    Reply
  • How to remove more than once instance , i do have 5 sql server instance in local system, i want to completelly remove 2 instance. can anybody assist me>

    Reply
  • To Uninstall a named instance of SQL Server 2000/2005,
    1.Click Start, Control Panel, click Add/Remove programs.
    2.Select a name of an instance of SQL Server 2000, and click Remove.
    3.Select the appropriate SQL Instance to remove
    4.Follow the Wizard to remove the SQL Instance

    Reply
  • I am getting the restart problem
    My system gets restart when ever i install SQL SERVER2005. and every time its restart…

    Can any one help me….

    Reply
  • Hi,
    I set up a backup dairly mode for sql server. But I have could copy the backup file which has extenstion name .bak to other folder. Notice for every time copying is “access is denied”
    I hope your help. Thanks a lot.

    Reply
  • Hi,
    I setup a backup dairly mode for sql server. But I have’nt could copy the backup file which has extension name .bak to other folder. The notice for every time copy is “access is denied” .
    I hope your help. Thanks a lot.

    Reply
  • dear sir,
    this is ramakrishna i am having the problem in opening of the microsoft sqlserver 2005 pls tell me.

    Reply
  • I have a program that uses SQL server 2005. when i open it today, I cant open the program, it says that cant connect to server. Upon Checking the SQL, I cant connect to my SQL server.
    when I check its configuration , it is not running, then I try to run SQL but it cant start the application..
    any help..???

    Reply
  • Devendra Kumar Rai
    March 14, 2011 2:01 pm

    Thank you very much for you tips..

    Reply
  • Hi guys
    I did I.T abut only did networking and nothing on programming. but now my boss wants me to design a sql service report. where do i begin to do that. responses would be greatly appreciated guys.

    Thanks
    Given

    Reply
  • There is also another problem I have with our server. Theres an error message that comes up, the error message says,

    [ ‘hotfix.exe. application error’

    The instruction at “0x002d002d” referenced memory at “0x00000000”. The memory could not be “written”

    Click OK to terminate the program
    Click on CANCEL to debug the program ]

    Now when this error message comes up it keeps stopping our sql server from running, i have to keep going to Microsoft SQL server services management. why does that happen and how do i stop it??

    Thanks.
    Given

    Reply
  • Hello,

    i try to restart sqlservice using these two commands

    ExecuteCommand(“net stop mssqlserver”);
    ExecuteCommand(“net start mssqlserver”);

    and code for function ExecuteCommand is as below..

    private int ExecuteCommand(string Command)
    {
    int ExitCode;
    ProcessStartInfo ProcessInfo;
    Process Process;

    ProcessInfo = new ProcessStartInfo(“cmd.exe”, “/C ” + Command);
    ProcessInfo.CreateNoWindow = true;
    ProcessInfo.UseShellExecute = false;
    Process = Process.Start(ProcessInfo);
    Process.WaitForExit();
    ExitCode = Process.ExitCode;
    Process.Close();

    return ExitCode;
    }

    but after executing these two statements. when i execute any Query i get the Following error..

    A transport-level error has occurred when sending the request to the server. (provider: Shared Memory Provider, error: 0 – The system cannot open the file.)

    can you help me find out the solution ..
    for executing Query, In My connection string, server name is name of sever not IP, also SQL server debugging is disabled from Project Property.

    Reply
  • Hi to All

    I have installed sql 2005 server, My sql server stop automatically , and the connection with the database terminates, Please help somebody……..

    Thanks in advance !

    Manish

    Reply
  • Hi,
    I am using SQL Server 2000 .My Pc has two local user accounts. When I log on with the Administrator user then in the SQL server service manager the server name displays automatically and the server is started automatically. But I face a problem when log on with the accountant user which has no administrator privilege. During this time in SQL server service manager, the server name displays blank and the server could not be started automatically. During this time I have to write the server name manually in the server option of SQL server service manager and then have to click the refresh services. Is there any way to make a batch file which can copy the server name in the server option of SQL server service manager automatically? My server name is same as the computer name and the accountant user is a power user.

    Reply
  • Hi,
    Just I open SQL Server by using command prompt
    NET START MSSQLSERVER and it is successfully done and I stop using
    NET STOP MSSQLSERVER and it is also successful

    My Question is LATER I WHEN I AM STARTED BY USING REGULAR WAY NOT BY COMMAND PROMPT BUT IT IS NOT WORKING WHY?

    Reply

Leave a Reply