Friday, August 3, 2007

How to resolve permission issues when you move a database between servers that are running SQL Server

MORE INFORMATION
When you move a database from one server that is running SQL Server to another server that is running SQL Server, a mismatch may occur between the security identification numbers (SIDs) of the logins in the master database and the users in the user database. By default, SQL Server 7.0, SQL Server 2000, and SQL Server 2005 provide the sp_change_users_login system stored procedure to map these mismatched users. However, you can only use the sp_change_users_login stored procedure to map standard SQL Server logins and you must perform these mapping for one user at a time. For more information about the sp_change_users_login stored procedure, see the "sp_change_users_login" topic in SQL Server 7.0,SQL Server 2000, and SQL Server 2005 Books Online.

Solution:

Under a specific database name, remove the user. But if there are schemas defined by the user/owner, you cannot delete the user from the security menu (studio). So, you need to change the owner to dbo first. And then you can delete the owner. then recreate the owner/user again. Finally, change back the schema ownership

No comments: