none
“Login failed for user.Failed to open the explicitly specified database 'DBNAME' RRS feed

  • Question

  • Hi All,

    We recently took a database offline, since then we are seeing multiple messages in the sql server log (windowsNT->APPLICATION)

    How to stop these messages

    “Login failed for user “user”. Reason.Failed to open the explicitly specified database ‘dbname’

    Thanks

    Tuesday, August 27, 2019 2:10 PM

Answers

  • Hi Lisa,

    If you have taken the DB offline then these messages are because something is trying to connect into the database but it can't because the DB is offline.

    If you look in the SQL error log then you will see the client IP address that this connection is coming from, which may help.  

    Thanks,

    Matt


    Tuesday, August 27, 2019 2:38 PM
  • One Login has "dbname" as default database and so the Login attempts fails, because the database isn't accessible. Change the Default database for the Login, e.g. to "master". You can get the login's with:

    select *
    from sys.server_principals as sp
    where default_database_name = 'dbname'


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Marked as answer by LisaKruger Tuesday, August 27, 2019 4:45 PM
    Tuesday, August 27, 2019 2:39 PM
    Moderator

All replies

  • Hi Lisa,

    If you have taken the DB offline then these messages are because something is trying to connect into the database but it can't because the DB is offline.

    If you look in the SQL error log then you will see the client IP address that this connection is coming from, which may help.  

    Thanks,

    Matt


    Tuesday, August 27, 2019 2:38 PM
  • One Login has "dbname" as default database and so the Login attempts fails, because the database isn't accessible. Change the Default database for the Login, e.g. to "master". You can get the login's with:

    select *
    from sys.server_principals as sp
    where default_database_name = 'dbname'


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Marked as answer by LisaKruger Tuesday, August 27, 2019 4:45 PM
    Tuesday, August 27, 2019 2:39 PM
    Moderator
  • Thanks Matt. I see the client IP Adress in the log,thanks got it
    • Edited by LisaKruger Tuesday, August 27, 2019 4:45 PM
    Tuesday, August 27, 2019 4:29 PM
  • Thanks olaf
    Tuesday, August 27, 2019 4:29 PM
  • Thanks Matt. I see the client IP Adress in the log, now how to get the user name associated with the client? or the machine

    You would have to hunt around on that machine. Since it is reoccurring, it is likely to be something like a service or a similar.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

    Tuesday, August 27, 2019 9:50 PM
    Moderator