1

enter image description hereEvent Viewer, I can fins this event logged :

2016-07-10 11:45:01.83 Logon Error: 18456, Severity: 14, State: 38. 2016-07-10 11:45:01.83 Logon Login failed for user 'Domain\Username'. Reason: Failed to open the explicitly specified database. [CLIENT: ]

So,I ran trace and found the database name,but how can I delete the missing database completely. Attached image.

I cannot find the database name in sp_helpdb or sys.databases.

Cannot open database "DBTest" requested by the login. The login failed.

  • 3
    You dont need to delete already deleted database. You need to see login properties and check whether default database it connects to is not the DBtest – Shanky Jul 11 '16 at 9:13
  • @Shanky,default database name is master.I checked in sys.server_princiapls – SQLBoy Jul 11 '16 at 9:34
  • 1
    In that case there is some application trying to connect to the database DBtest using that login and you need to find that – Shanky Jul 11 '16 at 9:45
  • 3
    also see this link which has all the login failures info: sqlblog.com/blogs/aaron_bertrand/archive/2011/01/14/… – TheGameiswar Jul 11 '16 at 9:52
  • @Shanky,I have attached the image of the trace.Can you please let me know how to proceed further.I know application,database name,login name now. – SQLBoy Jul 12 '16 at 9:59
2

You don’t need to delete the already missing database.The user is configured to use a none existing or deleted database as a default database for the application. First, use trace and check for which application the user is failed to login, then on the application, change the default database to one of the existing databases. Sadequl’s post might help you for step by step guide to fix the issue, https://www.mssqltips.com/sqlservertip/2581/sql-server-error-18456-finding-the-missing-databases/

  • 1
    I can see Application name is .Net SQLClient Data Provider from the trace file. – SQLBoy Jul 12 '16 at 3:17
  • 3
    A .Net SQLClient Data Provider actually is not the application name. You are seeing that on the trace because the application name is not specifically configured on the connection string. Now you might have to do one additional step. Set a trace &check all the statements and SP’s executed when that specific error occur, which will lead you which application using that. First, make sure the 'Domain\Username’ has appropriate permission and its default database should be one of the existing database. This will easily fix your issue. – Hailegziabher Dechassa Jul 12 '16 at 13:57
  • I tried adding the database back and run the trace still the issue exists – SQLBoy Jul 13 '16 at 10:14
  • 3
    You don’t necessarily have to create the database, you have to just check the failed user and your application and change the default to one of the existing databases. If you follow all the steps on this link, mssqltips.com/sqlservertip/2581/…, you can easily fix the issue. – Hailegziabher Dechassa Jul 13 '16 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.