A problem in restarting the service of MSSQLSERVER  
Author Message
BobSun





PostPosted: .NET Framework Data Access and Storage, A problem in restarting the service of MSSQLSERVER Top

I had the following problem in my application.

I need to Restart MSSQLServer service before do the connection test. In some cases, I have to Restart the MSSQLSERVICE again after connection test. In the old version of MSDE2000, no problem occured at all. But in MSDE2000 SP3a, I got the following error when restart the MSSQLSERVICE for a 2nd time.

But if I run the test program so as to execute RESTART and CONNECTIONTEST in pair each time, no error occured.

Can somebody give some advice to avoid this problem

Thank you!

The error log says :

2007-01-11 10:30:26.45 server Using 'SSNETLIB.DLL' version '8.0.766'.
2007-01-11 10:30:26.46 spid5 Starting up database 'model'.
2007-01-11 10:30:26.51 server SQL server listening on .
2007-01-11 10:30:26.53 server Error: 17826, Severity: 18, State: 1
2007-01-11 10:30:26.53 server Could not set up Net-Library 'SSNETLIB'..
2007-01-11 10:30:26.53 server Unable to load any netlibs.
2007-01-11 10:30:26.53 server SQL Server could not spawn FRunCM thread.

The test sources is:

private void RestartSQLServer()
{
ServiceController service = new ServiceController("MSSQLServer");

// Stop SQL service
if(service.Status.Equals(ServiceControllerStatus.Running))
{

RestartResult.Refresh();
service.Stop();
service.WaitForStatus(ServiceControllerStatus.Stopped);
}

// Start SQLServer service
if(service.Status.Equals(ServiceControllerStatus.Stopped))
{

RestartResult.Refresh();
service.Start(); <= error occured at the 2nd restart
service.WaitForStatus(ServiceControllerStatus.Running);
}
}

private void ConnectTest()
{
// Get connection string
String connectString = (String)(MyTestRegistry.GetValue(ConnectionValueName));

// Creat database reference
SqlConnection testConnection = new SqlConnection(connectString);

try
{
// 3.Open & Close connection to database
testConnection .Open();
testConnection.Close();
}

catch
{

}
}

private void button_Clicked(object sender, System.EventArgs e)
{
RestartSQLServer();
ConnectionTest();
RestartSQLServer();
}



.NET Development5  
 
 
Paul P Clement IV





PostPosted: .NET Framework Data Access and Storage, A problem in restarting the service of MSSQLSERVER Top


What do you see in the Windows System Event Log

 
 
BobSun





PostPosted: .NET Framework Data Access and Storage, A problem in restarting the service of MSSQLSERVER Top


What do you see in the Windows System Event Log

I got three error events and 1 normal event:

1.SuperSocket info: ConnectionListen(Shared-Memory (LPC)) : Error 5.
2.Error: 17826, Severity: 18, State: 1 Could not set up Net-Library 'SSNETLIB'.
3.19013 :SQL server listening on . (this is INFORMATION event)
4.17120 :SQL Server could not spawn FRunCM thread.

Can you give me some advice

Thank you.


 
 
Paul P Clement IV





PostPosted: .NET Framework Data Access and Storage, A problem in restarting the service of MSSQLSERVER Top


See if the following helps:

http://tinyurl.com/aea8a