The remote server reached the maximum number of connections, in order to achieve remote restart, so think of the SQL Statement command to implement this function, but the specific command format to forget, found a bit of information tutorial . net/c# Course [4]:sqlserver Basic application Development , Write the method below, hope can give you some help it, hehe.
First on the local computer--Create a restart script
DECLARE @o int,@f int,@t int, @ret int
exec sp_oacreate ' Scripting.FileSystemObject ', @o out
exec sp_OAMethod @o, ' CreateTextFile ', @f out, ' C:/restart.bat ', 1
EXEC @ret =sp_oamethod @f, ' WriteLine ', NULL, ' net stop MSSQLServer '
EXEC @ret =sp_oamethod @f, ' WriteLine ', NULL, ' net start mssqlserver '
connecting to a remote server via SQL database--performing a restart script
exec master. xp_cmdshell ' C:/restart.bat '
/*
If you restart your computer, make sure that the MSSQLServer account is running under the Administrator account (not the local System account)
*/
exec master. xp_cmdshell ' shutdown/r/F '
Here is a premise, it is necessary to use a component on the server, xp_cmdshell this component, but the general server,
this component is disabled. Therefore, you must first use the component before you can apply the above method.
Remote Control Database utility SQL Restart function