I am tasked to do DR for a 3 Tier Application, one of these is the MS SQL.
I have two sets, one in production and one in DR site.
The issue is, in an event of a disaster and the one in the production is totally wiped out. I will just restore the database to the DR site from the daily backup.
One of the issue I encountered is upon the restoration of the databases, are the SQL login.
Lets say the following logins are in the production:
WebApp
Developer
sa
AppTier
I have also created these in the DR SQL.
However, when the database has been restored to the DR server, the databases are inaccessible by these login in the DR site.
To fix I executed a query to each database using the below:
EXEC sp_change_users_login 'Auto_Fix', 'WebApp'
EXEC sp_change_users_login 'Auto_Fix', 'Developer'
EXEC sp_change_users_login 'Auto_Fix', 'sa'
EXEC sp_change_users_login 'Auto_Fix', 'AppTier’
If the database grows to thousands, executing the query above will take very long and will have an effect on the SLA.
How do I execute it to all the databases (e.g. Customer1 upto Customer 1000)?
Thank you.