SQL Server: Post restore activities regarding login
Hi Mates,
Recently working with sql server 2005 I have faced an issue. I have refreshed the development database with the production one. and after that users can't login to the database. When I restore a database, I ame quite often just restoring users to the database and not restoring server logins. Thus, I end up in a situation that I call orphaned users: a database with users but a server with different login SIDs for those users. Then what I did was remapping the logins. The steps are like below
It will then map that existing database user to a SQL Server login.
For further reading please go to the below sites
http://msdn.microsoft.com/en-us/library/ms174378.aspx
Recently working with sql server 2005 I have faced an issue. I have refreshed the development database with the production one. and after that users can't login to the database. When I restore a database, I ame quite often just restoring users to the database and not restoring server logins. Thus, I end up in a situation that I call orphaned users: a database with users but a server with different login SIDs for those users. Then what I did was remapping the logins. The steps are like below
USE mydbname
GO
sp_change_users_login 'Report'
GO
This will show the list of the database users which need to be mapped.
USE mydbname;
GO
EXEC sp_change_users_login 'Update_One', 'user_name', 'user_name';
GO
GO
EXEC sp_change_users_login 'Update_One', 'user_name', 'user_name';
GO
It will then map that existing database user to a SQL Server login.
For further reading please go to the below sites
http://msdn.microsoft.com/en-us/library/ms174378.aspx
Comments
Post a Comment