问题 将Windows8升级到Windows 10后,SQL Server无法正常工作


 TITLE: Connect to Server
------------------------------

Cannot connect to Thejus-PC.

------------------------------ ADDITIONAL INFORMATION:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or
> was not accessible. Verify that the instance name is correct and that
> SQL Server is configured to allow remote connections. (provider: Named
> Pipes Provider, error: 40 - Could not open a connection to SQL Server)
> (.Net SqlClient Data Provider)
> 
> ------------------------------ For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476
> 
> ------------------------------ Error Number: 2 Severity: 20 State: 0
> 
> 
> ------------------------------ Program Location:
> 
>    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
> exception, Boolean breakConnection, Action`1 wrapCloseInAction)    at
> System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
> stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)    at
> System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo,
> SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout,
> Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean
> integratedSecurity, Boolean withFailover, SqlAuthenticationMethod
> authType)    at
> System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo
> serverInfo, String newPassword, SecureString newSecurePassword,
> Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean
> withFailover)    at
> System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo
> serverInfo, String newPassword, SecureString newSecurePassword,
> Boolean redirectedUserInstance, SqlConnectionString connectionOptions,
> SqlCredential credential, TimeoutTimer timeout)    at
> System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer
> timeout, SqlConnectionString connectionOptions, SqlCredential
> credential, String newPassword, SecureString newSecurePassword,
> Boolean redirectedUserInstance)    at
> System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
> identity, SqlConnectionString connectionOptions, SqlCredential
> credential, Object providerInfo, String newPassword, SecureString
> newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString
> userConnectionOptions, SessionData reconnectSessionData,
> DbConnectionPool pool, String accessToken)    at
> System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
> options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo,
> DbConnectionPool pool, DbConnection owningConnection,
> DbConnectionOptions userOptions)    at
> System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection
> owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions
> userOptions)    at
> System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection
> owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions
> userOptions, DbConnectionInternal oldConnection, DbConnectionInternal&
> connection)    at
> System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection
> outerConnection, DbConnectionFactory connectionFactory,
> TaskCompletionSource`1 retry, DbConnectionOptions userOptions)    at
> System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection
> outerConnection, DbConnectionFactory connectionFactory,
> TaskCompletionSource`1 retry, DbConnectionOptions userOptions)    at
> System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1
> retry)    at
> System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1
> retry)    at System.Data.SqlClient.SqlConnection.Open()    at
> Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ValidateConnection(UIConnectionInfo
> ci, IServerType server)    at
> Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()
> 
> ===================================
> 
> The system cannot find the file specified

8897
2017-07-31 02:37


起源

SQL Server是否已成功启动?嗯,Windows 10是非常新的(从官方发布仅几天),可能会发生很多有趣的事情。 - Raptor
知道什么可能也很重要 版 和 版 您正在使用的SQL Server。某些旧版本可能在Windows 10上不受官方支持。 - Damien_The_Unbeliever
它解决了。实际上服务器服务甚至没有启动甚至启动类型是自动的。我手动启动它现在工作正常。 - thejustv
非常感谢这个问题。由于这个问题,我无法使用我的数据库一年 - Failed Scientist


答案:


请验证是否已启动服务“SQL Server(MSSQLSERVER)”。

我启动了“SQL Server(MSSQLSERVER)”服务,现在我可以进入Sql server。


8
2017-08-01 17:48



如果这是您的问题的答案,那么将此答案标记为“已回答”,以便将来的用户知道这解决了问题。 - Johnathon Sullinger
这是正确的答案,但升级后,SQL Server服务需要在每次重启后手动启动。如果有人知道对此有适当的解决方案,那么请评论或回答。 - David Kirkland
尝试将启动类型更改为手动并尝试一个。我更改为手动,现在我们打开SSMS时自动启动 - thejustv
@DavidKirkland右键单击任务管理器中的服务。点击“打开服务”。在列表中找到该服务,然后双击。选择'Automatic'作为启动选项。 - serdar
@serdar感谢您的建议。该服务设置为自动启动,但自从升级到Win10后,它无法在Windows启动时启动。如果我手动启动它可以工作,但我不想在每次重启后执行此操作。我刚刚为延迟启动设置了服务,我会在下次重启后看看是否有效... - David Kirkland


请验证是否已启动服务“SQL Server(MSSQLSERVER)”。刚才我升级到Windows 10并遇到了同样的问题。

我启动了“SQL Server(MSSQLSERVER)”服务,现在我可以进入Sql server。


5
2017-08-02 20:26





我们在Windows 7和Windows 8中遇到过此问题。升级后SQL Server无法启动。我们已经能够手动启动它,但它不会自动启动。

到目前为止,我们唯一的解决方案是卸载并重新安装SQL Server。


1
2017-08-19 18:31





尝试将连接字符串更改为IP / NameInstance,它适用于我。之前我曾经在我的连接字符串中使用localhost / NameInstance但是因为我更新到了Windows 10,所以它不再起作用了。


0
2017-08-12 18:42