locked
Start SQL server services RRS feed

  • Question

  • dear experts,

    i often get stuck that an application is not starting.

    really what had happend is that the SQL server services are not started somwhow.

    once i open sql configuration manager and start the service norammly things start.

    i tried 

    1)https://support.microsoft.com/en-in/help/912426/how-to-detect-the-status-of-the-sql-server-express-service-or-start-th

     error:can not start mssqlserver service on computer (kings) ...

    2)Process.Start("sqlservr.exe"); give error:system can not find file specified 

    can someone tell me how this error can be resolved using c#.net program 


    • Edited by Sushil Agarwal Thursday, April 11, 2019 5:39 AM typo error
    Thursday, April 11, 2019 5:38 AM

Answers

  • Here  you go

    https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/start-stop-pause-resume-restart-sql-server-services?view=sql-server-2017

    From a command prompt, enter one of the following commands:

    net start "SQL Server (MSSQLSERVER)"

    -or-

    net start MSSQLSERVER


    Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/

    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting: Large scale of database and data cleansing
    Remote DBA Services: Improves MS SQL Database Performance
    SQL Server Integration Services: Business Intelligence

    Thursday, April 11, 2019 9:46 AM
    Answerer
  • please do correct me, if any good solutions are avilable

    This can also be done programmatically from your .NET application using a ServiceController. The following code snippet assumes the project references System.ServiceProcess assembly and a using statement exists for the System.ServiceProcess namespace.

    using (ServiceController service = new System.ServiceProcess.ServiceController("MSSQLSERVER"))

    {

    service.Start(); service.WaitForStatus(ServiceControllerStatus.Running, (new TimeSpan(0, 0, 30))); Console.WriteLine($"MSSQLSERVER is {service.Status.ToString()}."); if (service.Status != ServiceControllerStatus.Running) { throw new Exception($"MSSQLSERVER service did not start."); } }



    Dan Guzman, Data Platform MVP, http://www.dbdelta.com


    Thursday, April 11, 2019 10:30 AM
    Answerer

All replies

  • Can you show us detailed error message?

    Did you sqlservr.exe get moved? There should be something in error logs or the Event logs that an attempt was even made. Can identify its location?


    Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/

    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting: Large scale of database and data cleansing
    Remote DBA Services: Improves MS SQL Database Performance
    SQL Server Integration Services: Business Intelligence

    Thursday, April 11, 2019 5:44 AM
    Answerer
  • dear experts,

    i often get stuck that an application is not starting.

    really what had happend is that the SQL server services are not started somwhow.

    once i open sql configuration manager and start the service norammly things start.

    i tried 

    1)https://support.microsoft.com/en-in/help/912426/how-to-detect-the-status-of-the-sql-server-express-service-or-start-th

     error:can not start mssqlserver service on computer (kings) ...

    2)Process.Start("sqlservr.exe"); give error:system can not find file specified 

    can someone tell me how this error can be resolved using c#.net program 


    Ideally you should have some Event log error entries if it tried to start sqlservervices and faced any issue or became down due to some issue

    I hope your sqlservices are set to startup type of Automatic upon server restart



    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    ----------------------------
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page


    Thursday, April 11, 2019 6:39 AM
    Answerer
  • I think i have not asked the question properly.

    what i have felt exeprts are advicing the sql configuration manager to start stop the sql server instance

    or

    want me to elaborate on exact error by studying the error log becuase i want to restart it.

    i simply wanted how from the clicked onece published application can we start sql server instance if its stopped.

    for the time being i have found that better make a batch file having

    net start mssqlserver

    run it as administrator on server is the simplest solution.

    or using poweshell commandlets.

    please do correct me, if any good solutions are avilable


    Thursday, April 11, 2019 9:44 AM
  • Here  you go

    https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/start-stop-pause-resume-restart-sql-server-services?view=sql-server-2017

    From a command prompt, enter one of the following commands:

    net start "SQL Server (MSSQLSERVER)"

    -or-

    net start MSSQLSERVER


    Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/

    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting: Large scale of database and data cleansing
    Remote DBA Services: Improves MS SQL Database Performance
    SQL Server Integration Services: Business Intelligence

    Thursday, April 11, 2019 9:46 AM
    Answerer
  • please do correct me, if any good solutions are avilable

    This can also be done programmatically from your .NET application using a ServiceController. The following code snippet assumes the project references System.ServiceProcess assembly and a using statement exists for the System.ServiceProcess namespace.

    using (ServiceController service = new System.ServiceProcess.ServiceController("MSSQLSERVER"))

    {

    service.Start(); service.WaitForStatus(ServiceControllerStatus.Running, (new TimeSpan(0, 0, 30))); Console.WriteLine($"MSSQLSERVER is {service.Status.ToString()}."); if (service.Status != ServiceControllerStatus.Running) { throw new Exception($"MSSQLSERVER service did not start."); } }



    Dan Guzman, Data Platform MVP, http://www.dbdelta.com


    Thursday, April 11, 2019 10:30 AM
    Answerer
  • sql services are running local or service account ?

    Check event viewer,error log and complete error message.

    All drives are online?


    https://social.technet.microsoft.com/wiki/contents/articles/37872.sql-server-installation-on-centos-linux.aspx

    Thursday, April 11, 2019 2:03 PM