Sql-server – Failed SQL Login – Source server same as destination cannot locate SPID SQL Server 2014

loginssql serversql server 2014

Bit of a confusing one here.

We are getting repeated messages in the SQL Server error log as below for a SQL Server instance:

NT AUTHORITY\SYSTEM
Reason: Failed to open the explicitly specified database XXX [CLIENT: xx.xx.xxx.xx]

SQL Server Profiler shows nothing nor does sp_who2 or sys.dm_exec_requests.

The client IP Is actually the same SQL Server instance, with the source in the Windows Application Log being MSSQLSERVER – so its trying to connect to itself but failing.

However I cannot find what exactly is occurring. The start of these messages is recorded in the SQL Log. As you can see the database was started up due to a CHECKDB. The CHECKDB completed then the login errors have been there since.

2015-07-13 22:11:27.790 spid30s Starting up database XXX.
2015-07-13 22:11:28.480 spid30s CHECKDB for database XXX finished without errors on 2015-07-11 03:36:12.720 (local time). This is an informational message only; no user action is required.
2015-07-13 22:11:33.780 Logon Login failed for user 'NT AUTHORITY\SYSTEM'. Reason: Failed to open the explicitly specified database XXX. [CLIENT: XX.XX.XXX.XX]
2015-07-13 22:11:38.750 Logon Login failed for user 'NT AUTHORITY\SYSTEM'. Reason: Failed to open the explicitly specified database XXX. [CLIENT: XX.XX.XXX.XX]

Any info on this would be appreciated!

Best Answer

I've seen this before. I believe that it was due to autoclose. But I could not recall from memory. Credit here goes to Aaron Bertrand.

Usually this means the login's default database is offline (perhaps due to AutoClose) or no longer exists. Resolve by fixing the missing database, or changing the login's default database using ALTER LOGIN (for older versions, use sp_defaultdb, which is now deprecated). This is reported as state 16 prior to SQL

Server 2008. Error: 18456, Severity: 14, State: 40. Login failed for user ''. Reason: Failed to open the explicitly specified database.

Blog post regarding SQL login errors