Skip to end of banner
Go to start of banner

How to fix orphaned SQL Server users after migration

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »


This how to article explains how to fix orphaned user after migration in SQL Server

\uD83D\uDCD8 Instructions

Follow steps below:

  1. Connect to migrated SQL server and find migrated database.

  2. Right click and run a new query.

    EXEC sp_change_users_login 'Report'
  3. Get the results and run another query by replacing usernames in the result and execute.

    EXEC sp_change_users_login 'Auto_Fix', 'replace_user_name_in_the_result'

You can find your user name prefix from config file, here is an example below:

<dbdatabasename>epicentre_database</dbdatabasename>
<dbuserprefix>epicentre_prefix</dbuserprefix>

After migration, usernames in the result should be like:

  • epicentre_prefix_user

  • epicentre_prefix_dbo

  • epicentre_prefix_reader

Filter by label

There are no items with the selected labels at this time.

  • No labels