Solution: SQL Server login failed for user
Problem: I successfully restored a DB to a new server. However when I try to connect to the restored DB, I get error message:
Cannot open database requested in login ‘my_database’. Login fails. Login failed for user ‘my_login’.
I made sure this user is present in the DB. I also confirmed the login for this user name is present in server logins.
Solution: Run the following SQL script for this DB
EXEC sp_change_users_login ‘Auto_Fix’,’my_login’,NULL