Score:0

How to sync SQL Server Logins with database User after a restore from another server

in flag

I have a database server with several databases inside. This server is used as test server to store a set of test databases. The test databases do not come from the same production server thus I can have a mixed context where multiple test databases in test server come from different production servers. The logins and the mapped users in all the production servers have the same name but indeed their login passwords are different.

I use a Powershell Azure CLI script in order to copy the production databases from their source production server and restore them in the unique target test database.

The issue is that there is an inconsistent state between the mapping of the logins in the test server and the user in the test database, since even though they got the same name their identifier is probably different.

How can I map the test server login password to each user in the databases by using the name as a matching criteria?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.