question

vivekchandra09 avatar image
vivekchandra09 asked

Getting error Login failed for user 'Server\svc_sql'. Reason

The Server is a SQL Server 2008R2 instance. The error message says further : ' Failed to open the explicitly specified data database. [Client : local machine] Error : 18456, severity: 14, State:38
sql server 2008 r
6 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

KenJ avatar image KenJ commented ·
and, of course, make sure the database exists. I did that as a fun prank one time. Since you can't deny a sysadmin login rights, I changed a DBA friend's default database to a dummy database then dropped that database. Good times all around :)
1 Like 1 ·
KenJ avatar image KenJ commented ·
@JohnM - it *might* have been you
1 Like 1 ·
sjimmo avatar image sjimmo commented ·
You state that the error message says further: What is the complete error message?
0 Likes 0 ·
JohnM avatar image JohnM commented ·
I would guess there's a login specified within that error message. If so, it doesn't have any rights to the database specified. Grant the login db_reader (or whatever appropriate permissions it needs) and see if that resolves the issue.
0 Likes 0 ·
JohnM avatar image JohnM commented ·
That wasn't me was it @KenJ? ;-) I can't remember.
0 Likes 0 ·
Show more comments

1 Answer

·
vivekchandra09 avatar image
vivekchandra09 answered
https://www.mssqltips.com/sqlservertip/2581/sql-server-error-18456-finding-the-missing-databases/ a user error message is sent to the client, then an Error Log entry is made and then the login failure audit is captured. Clicking on a User Error Message entry right before the Error Log entry gave me the name of the database that was causing the error. The message was something like the following: "Cannot open database requested by the login. The login failed." As I queried the sys.databases table, obviously there was no entry for that name, which proved my initial premise that the database had been dropped.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.