May 5, 2010 at 5:31 am
I have a sql user in a database but after backing up the database and restoring to different server i lost access to the database though the user is existing, why so ? its not the case with windows user though.
May 5, 2010 at 5:39 am
Because the sql user account needs to be created on sql server level as well, not only db level.
drop the account from the DB, recreate it on sql server level, and apply correct permissions on the specific db again.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This thing is addressing problems that dont exist. Its solution-ism at its worst. We are dumbing down machines that are inherently superior. - Gilfoyle
May 5, 2010 at 6:01 am
Best practice is create/transfer login to new server and then map users(should exist in particular database)there
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
May 5, 2010 at 7:12 am
Henrico Bekker (5/5/2010)
Because the sql user account needs to be created on sql server level as well, not only db level.drop the account from the DB, recreate it on sql server level, and apply correct permissions on the specific db again.
Like Henrico said, the sql user "bob" on my server is not the same "bob" on your server;
behind the scenes each login has a unique SID in my master.dbo.syslogins;
the user in [yourdatabase].sys.users either does not have a matching login at all in master.dbo.syslogins, or the login has a different SID than expected. This is often called an orphaned user, adn if the login exists, you can use the procedure sp_change_users_login
http://www.fileformat.info/tip/microsoft/sql_orphan_user.htm
First, make sure that this is the problem. This will lists the orphaned users:EXEC sp_change_users_login 'Report'
If you already have a login id and password for this user, fix it by doing:
EXEC sp_change_users_login 'Auto_Fix', 'user'
If you want to create a new login id and password for this user, fix it by doing:
EXEC sp_change_users_login 'Auto_Fix', 'user', 'login', 'password'
Lowell
May 5, 2010 at 11:21 am
both are same databases on Prod and Dev and has same users in it. when i insert monthly data in Dev database, i have do a backup and restore on to prod server with different name. once it is in prod i will switch over the names but i miss this sql user for which i have to drop and re create.
May 6, 2010 at 12:00 am
Tara-1044200 (5/5/2010)
i miss this sql user for which i have to drop and re create.
whenever we restore backup , users automatically get transferred (obviously orphan users) . So how did you miss it?
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply