SQL Server fails to start with ERRORLOG reporting “TDSSNIClient initialization failed with error 0x5, status code 0xXX”

I have seen this issue multiple times. So I post the problem and the solution here. 

0x5 is ERROR_ACCESS_DENIED, the windows error code for “Access is denied”. A typical SQL Server ERRORLOG looks like,

2006-03-06 10:48:27.99 Server Server is listening on [ 'any' <ipv4> 1433].

2006-03-06 10:48:28.07 Server Server local connection provider is ready to accept connection on [ \.pipeSQLLocalMSSQLSERVER ].

2006-03-06 10:48:28.07 Server Error: 26029, Severity: 16, State: 1.

2006-03-06 10:48:28.07 Server Server named pipe provider failed to listen on [ \.pipesqlquery ]. Error: 0x5

2006-03-06 10:48:28.16 Server Error: 17182, Severity: 16, State: 1.

2006-03-06 10:48:28.16 Server TDSSNIClient initialization failed with error 0x5, status code 0x50.

2006-03-06 10:48:28.18 Server Error: 17182, Severity: 16, State: 1.

2006-03-06 10:48:28.18 Server TDSSNIClient initialization failed with error 0x5, status code 0x1.

2006-03-06 10:48:28.19 Server Error: 17826, Severity: 18, State: 3.

2006-03-06 10:48:28.19 Server Could not start the network library because of an internal error in the network library. To determine the cause, review the errors immediately preceding this one in the error log.

2006-03-06 10:48:28.22 spid8s Starting up database 'tempdb'.

2006-03-06 10:48:28.22 Server Error: 17120, Severity: 16, State: 1.

2006-03-06 10:48:28.22 Server SQL Server could not spawn FRunCM thread. Check the SQL Server error log and the Windows event logs for information about possible related problems.

During service starting up, SQL Server needs to open listening named-pipes to accept client share memory or named-pipe connections. If the listening named-pipes are not closed properly during the last shutdown of SQL Server, there will be orphan named-pipe handles in the windows kernel file system. Since the listening pipes are opened ACLing to the current user, if you happen to switch SQL Server to run under different account, you will get error 0x05(ERROR_ACCESS_DENIED). These behavior is very similar to cases where you get denial when opening a file that is opened by another user process. One frequent case that makes SQL Server to switch running account is that user first runs it under console session for debugging purpose then switches back to run it as installed service. Normally, the service account is different from the current user account that is used for running the console session. There are few cases that can cause SQL Server fail to clean up the listening named pipes. One example is that SQL Server is shutdown by kill process.

The solution is to either switch back to previous account and make a clean shutdown of SQL Server, or reboot the machine. In most cases, I feel the later is faster.

Note that, status code 0x50 is for listening pipe of named pipe provider that was not closed properly, while status code 0x40 is for shared memory provider. For status code with regarding to different network providers, you can refer to https://blogs.msdn.com/sql_protocols/archive/2006/01/10/511330.aspx

 

Do you know that you can post question w.r.t SQL Server data access, connectivty issues at https://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=87&SiteID=1 ?

Nan Tu

Software Design Engineer, SQL Server Protocols

Disclaimer: This posting is provided "AS IS" with no warranties, and confers no rights