Skip to content

[FIX}SQL Server Error “The database XXXX is not accessible (ObjectExplorer)”

November 22, 2012

Recently after restoring a database backup which i got from another server i repeatedly encountered an error when logged in using a user who is given permission. But when ‘sa’ account is used i could work with the database without any problem.

     Later i found that the issue is because the user in the restored database is not properly mapped to the user in the new server and the resolution for this is to run the stored procedure sp_change_users_login to correct the orphaned user.

  •       sp_change_users_login ‘update_one’, ‘USER’, ‘LOGIN’ — Links the given user in the       current database to the specified login.

sp_change_users_login ‘suto_fix’, ‘USER’ –Links the given user in the current database to the login having the same name in the current server.

After running this you will be able to access the restored database without any issue using the mentioned database user. 

 

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: