How to fix orphan users problem in SQL

How to fix orphan users problem in SQL

After MSSQL database restore you might to meet with situation that in DB will be orphan users. Simply, it is empty login name without any assignment with user. We can check it and then will see that there is 2 the same login names but with different SID numbers like on the picture below.

To list all problematic users you have to execute below command using a user with „sysadmin” permissions.

Here we have a problem with user called reports. First we have to ensure that user with that name is exist. If yes, then execute below command.

The result will be:

In case there is no such user we need to create it, for example by using this command.

Komentarze

Nie ma jeszcze komentarzy. Może zaczniesz dyskusję?

Dodaj komentarz

Twój adres e-mail nie zostanie opublikowany. Wymagane pola są oznaczone *