Understanding and processing orphaned users in a SQL Server database

Source: Internet
Author: User

Problem

Attaching and restoring a database from one server instance to another is a common task that database administrators perform. After attaching or recovering a database, the logins previously created and configured in the database are no longer accessible. The most common symptom of this problem is that the application encounters a logon failure error, or that when you try to add a login to the database, you may get a message that the user already exists in the database. When you perform an additional or a recovery, this is a very common situation, so how do you solve the problem?

Expert answers

When a database migrates from one server to another, the login IDs stored in the master-slave database do not match the login IDs stored in each user database. As mentioned above, some of the errors you will see after attaching or recovering a database include:


%s Permission denied on object%.*s, database%.*s, owner%.*s

Or

Microsoft SQL-DMO (ODBC sqlstate:42000) Error 15023:user or role '%s ' already exists to the current database.

Without proper understanding and proper planning, you may encounter this problem. You may delete and recreate this user, but you will release all configured permissions. So a proper link mechanism is needed, so you want to retain permissions.

Some of the possible error messages you may see include

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.