Login failed for user '<db_user>'. Reason: Failed to open the explicitly specified database '<DB1>'. [CLIENT: <local machine>]

arun sampath 21 Reputation points
2021-07-21T11:34:45.537+00:00

I restored my production database "DB1" in development server. The database contains 'db_user' schema.
Same 'db_user' name i am using prod and dev.

After restoration, when 'db_users' trying to connect db, getting error "The Database DB1 is not accessible".

Also i checked in errorlog "Login failed for user 'db_user'. Reason: Failed to open the explicitly specified database 'DB1'. [CLIENT: <local machine>]"

i am getting error, when tried to grant access,

116678-image.png

SQL Server Other
0 comments No comments
{count} votes

Accepted answer
  1. Olaf Helper 47,436 Reputation points
    2021-07-21T12:25:32.297+00:00

    Same 'db_user' name i am using prod and dev.

    May the same name, but different SID's and that one is important. So you have an "orphaned user", a database user without a login matching by the SID.
    => Troubleshoot orphaned users (SQL Server)


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.