Fix / restore user and login mappings in SQL Server

If you restore a SQL Server (< 2012) database on an other database server make sure you fix the user and login mappings by following the steps on http://atakala.com/browser/Item.aspx?user_id=amos&dict_id=2036

Short fix:

use MyDatabase

go

sp_change_users_login ‘update_one’, ‘myusername’, ‘myloginname’

 

Note

On SQL Server 2012 you can use Contained Databases, see http://blog.master-it.nl/blog00224/SQL_Server_2012_Contained_Databases_geen_Orphaned_Users_meer.htm

Leave a Reply

Your email address will not be published. Required fields are marked *