Start, Stop and Restart SQL Server and SQL Server Agent from Command Prompt

Click:
Start -> Run -> type cmd to start Command prompt.

To start default instance of SQL Server:
net start mssqlserver

To start a named instance of SQL Server type:
net start "SQL Server (instancename)"
or
net start MSSQL$ instancename

After starting SQL Service instance, you can start SQL Server Agent:

To start the default instance of SQL Server Agent:
net start "SQL Server Agent (MSSQLSERVER)"
or
net start SQLSERVERAGENT

To start a named instance of SQL Server Agent:
net start "SQL Server Agent(instancename)"
or
net start SQLAgent$ instancename

To stop default instance of SQL Server:

First stop SQL Server Agent:

To stop the default instance of SQL Server Agent:
net stop "SQL Server Agent (MSSQLSERVER)"
or
net stop SQLSERVERAGENT

To stop a named instance of SQL Server Agent:
net stop "SQL Server Agent(instancename)"
or
net stop SQLAgent$ instancename

Then stop SQL Server:
net stop mssqlserver

To stop a named instance of SQL Server type:
net stop "SQL Server (instancename)"
or
net stop MSSQL$ instancename

To restart default instance of SQL Server type:
net stop mssqlserver
net start mssqlserver

For restarting SQL Server and SQL Server Agent you can create a batch file called restartsql.bat with the following commands in it, save it, and run it when needed:

@ECHO OFF
net stop "SQL Server Agent (MSSQLSERVER)"
net stop MSSQLSERVER
net start MSSQLSERVER
net start "SQL Server Agent (MSSQLSERVER)"

If the post helped you, please share it:
Pin It

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">