Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to migrate an old, problematic Plesk server to a new one but there are some problems with SQL Server 2008.

Plesk couldn't migrate one of the DBs. So, I backed up the DB and restored on the new server. Then I tried to restore 'User Mappings' for the existing user but I got "User, group, or role already exists in the current database" error. I googled for solutions and found a few but they didn't work.

I tried to run the following procedure but no luck.

sp_change_users_login 'Auto_Fix', 'UserName'

I also tried to delete it's scheme as a solution but couldn't do it because - according to SQL Server - it's referenced by an object.

I don't want to change that object's user/scheme because I am afraid of to broke something.

What should I do?

share|improve this question

migrated from Aug 5 '12 at 15:19

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted

Note : Whenever you move your database from one server to another server there is a problem of orphan user usually occur. FileListOnly is the new term in sql server that has all the details of the created backup that who has access to it.

So there are sequence of task that you have to follow

  1. Firstly you have to restore the FileListOnly from the created backup to the destination or new server.
  2. Restore the backup.
  3. Use the sp_change_users_login as per the need. For help regarding this procedure you can refer

I put a example here hope it will help:

> N'YourDB' TO N'D:\YourDB.mdf', MOVE N'YourDB_log' TO N'D:\YourDB.ldf',
> exec YourDB.dbo.sp_change_users_login 'update_one', 'UserName','UserName'
share|improve this answer
What if DB and user(s) is already created by Plesk? Should I use the same method ? – Tim Aug 7 '12 at 16:16
USE database;
EXEC sp_change_users_login 'Update_One', 'username1', 'username1';
share|improve this answer
Please consider expanding this answer beyond just raw code. For example, you could explain what this does, and why you think it will fix the problem described in the question. – Paul White Feb 7 '15 at 13:35
@Milton, I second Paul White's comment. – Vérace Feb 7 '15 at 14:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.