Hello all, I have 2 servers- one development and one production - they both have the same database A and same SQL server login BB for this database. I wanted to refresh database in DEV by doing the restore a backup from Production. The restoration complete successfully . HOwever the SQL server login BB doesn't work in database A in DEV anymore, i have to drop user BB from database in DEV and give it permission again . Do i have to do it everytime I refresh my database in DEV from production or there're something i just need to do after i restore the database so i don't need to drop the user.?
One workaround is to use the sp_help_revlogin stored procedure to create the same users (including their SIDs) in your DEV environment that exist in your PROD environment. Syncing the SIDs will eliminate this orphaned user issue completely.
Keep in mind that sp_help_revlogin will also bring over their passwords in encrypted form. This means that the users passwords will be the same in DEV and PROD. This might not be a problem, but I prefer to have different passwords in use across a DEV/TEST/PROD landscape.