Use sp_change_users_login to remove SQL Server isolated users

Source: Internet
Author: User
An isolated account means that the account of a database only has a user name but no logon name. Such a user exists in the sysusers system table of the user database, but there is no corresponding record in syslogins of the master database.

Two types of isolated accounts are generally generated:
1. Restore the backed up database on another machine;
2. After the system or SQL Server is reinstalled, only the user library is restored.

The solution is to use sp_change_users_login.

Sp_change_users_login can be used in three ways:

Usage 1:
Exec sp_change_users_login 'report'

List isolated users of the current database

Usage 2:
Exec sp_change_users_login 'Auto _ fix', 'username'

You can automatically add the login with the same name as the user name to syslogins.

Usage 3:
Exec sp_change_users_login 'Update _ one', 'username', 'username'
Maps the user name to the specified Login Name.

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.