简体   繁体   中英

How to transfer the existing database users to a new ms sql server?

I have imported my database to a new ms sql server. This works but the logins are not working. They exists on the database itself but they are not available in the security->logins area of the ms sql server. I tried to create them manually there but receive the exception that they already exists on my database.

How can I achieve that these logins are active for my new ms sql server?

Thanks

Add the logins to the server, but don't associate them with the database. Then, run this:

USE [your database];
GO    
ALTER USER {user} WITH LOGIN={login};

Found the solution which works for me

USE testdb;
GO
EXEC sp_change_users_login 'Auto_Fix', 'testuser', NULL, 'testpwd';
GO

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM