Database Restore

  • When restoring a database with a copy of the database from another server we run into a problem with the user. The user does not appear in the users list but when you go to add it an error is returned saying the user already exists. So I drop the user using SP_DROPUSER and then I can add the user and everything is fine. No Problem, but I cannot do this if there happens to be objects owned by this user in the database. Has anyone run into this and does anyone have another work around ?

  • Hi,

    I don't know how to avoid this problem.

    To solve, I create the login and after that I use the command sp_change_users_login.

    Maybe it works for you to.

    Takeda.

  • Thats the right answer. The ID associated with the login will be different when you restore. You'll only see this problem with sql logins, NT logins are treated differently.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • Hi,

    I have a different problem : it was a local NT group which seems right now

    orphaned on a different server after the database restore.

    I can't drop it, the message : User 'username' does not exist in the current database. Although I can see it in the SYSUSERS table within the restored

    database. Of course, I can't create a user with the same name - I receive

    the message : User 'username' already exists in the current datatbase.

    Please, help.....

    Thanks a lot.

  • Are you runnign SP_DROPUSER while in the context of the database where this orphaned account is. In QA that database should be listed on the toolbar as the current selected.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Of course, I started sp_dropuser against the CORRECT database.

    BTW, I've already solved the problem : you can't use sp_dropuser with

    the local NT group as I described in my question.

Viewing 6 posts - 1 through 5 (of 5 total)

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