MS SQL Server Account processing

Source: Internet
Author: User

MS SQL Server Account Processing

orphaned accounts are typically produced in the following two ways:
1 .restore the backed up database on the other machine; 
2 .
re-install the system orSQL SERVERthen only the user library is restored 

Workaround:

First, sp_change_users_login to fix.

Second, delete the account and re-create

sp_change_users_login
There are three ways to use

usage 1 : 
Execsp_change_users_login ' report '
List orphaned users of the current database

usage 2 : 
exec sp_change_users_login ' auto_fix ', '
User name'
you can automatically add a login with the same name that corresponds to the user name tosysloginsin


usage 3 : 
execsp_change_users_login ' Update_One ', '
User name', 'Login Name'
maps the user name to the specified login name.

Second, delete the account and re-create

See if the user SID is consistent, and if not, delete and re-create the account.

Selectname,sid from master.sys.server_principals where name = ' HELLO_RW '

Select Name,sid from sys.database_principals where name = ' HELLO_RW '

Delete Account Statement

EXEC sp_dropuser ' Hello _rw ';

GO

Create an account:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/4C/F4/wKiom1RIWSTDOZRpAAHPWlpQeBg227.jpg "title=" 1.png " alt= "Wkiom1riwstdozrpaahpwlpqebg227.jpg"/>

Permission to write

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/4C/F5/wKioL1RIWYSgaJPCAAEQRFguDtI861.jpg "title=" 2.png " alt= "Wkiol1riwysgajpcaaeqrfgudti861.jpg"/>


This article from "lyq314" blog, declined reprint!

MS SQL Server Account processing

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.