Sync SQL Logins utility on 2005/2008

2019-06-14 05:23发布

问题:

Anyone point my at a utility for syncing sql server logins after restoring a database to a different server?

I know I can do it with scripts, but I've been using a wonderful little utility - 'Db Maint Sync SQL Logins' (http://www.dbmaint.com/SyncSqlLogins.asp) to do it on sql server 2000 which unfortunately doesn't support 2005 and I'm loath to go back to actually thinking :-)

回答1:

sp_change_users_login with the Update_One action can map a login in a database to a user on a new server.



回答2:

You can use sp_change_users_login with the Auto_Fix option to automatically link logins and users with the same name.

If when you're setting up the server, you script the logins along with their SIDs, then you won't have the mismatched user and login problem at all.



回答3:

The sync sql server logins tool by dbmaint has a sql server 2005 version: link text