Error 21002 [SQL-DMO] user ''bob'' already exists

  • I am trying to setup a new server with databases that exist on an old server.  My plan is to create a blank database and restore the backup database to the new server. 

    I have created the database and pointed the data/log files to the appropriate locations.  I created a user and assigned it ownership to the database.  After the restore, the user exists in the database, but the user in the security section does not have permission.  if i try to add the user it get the error above.

     

    Am i missing something? 

  • Open the database>Users and delete bob from the database and then re-add the login.  Be sure to note what permissions bob has before you delete him!!

  • Thanks, but the user is owner of a whole bunch of stuff. 

     

    Someone told me to use

    sp_change_users_login 'Auto_Fix', 'username', NULL, 'passwork'

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_ca-cz_8qzy.asp

     

    It worked like a charm.  The user in the database and the SQL user are synched.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply