고립된 사용자 해결 방법
1.고립된 사용자와 같은 이름의 로그인 사용자를 만들고 대상의 소유자를 변경합니다
sp_changeobjectowner [ @objname = ] 'object' , [ @newowner = ] 'owner'
예:
use authors
exec sp_changeobjectowner 'authors', 'dbo'; GO
단점: 수정해야 할 데이터베이스 대상이 많을 때 귀찮아요!!
2.
sp_change_users_login 'Auto_Fix', 'test', NULL, 'testpassword'
주:test는 고립된 사용자 이름이고testpassword는 고립된 사용자 비밀번호 자료:spchange_users_login(Transact-SQL)은 기존 데이터베이스 사용자를 SQL Server 로그인 이름으로 매핑합니다.참고:
sp_change_users_login은 Windows 바디에서 만든 SQL Server 로그인 이름에 사용할 수 없습니다.
sp_change_users_login (T-SQL)
sp_change_users_login (T-SQL)
Changes the relationship between a Microsoft® SQL Server™ login and a SQL Server user in the current database.
Syntax
sp_change_users_login [@Action =] 'action' [,[@UserNamePattern =] 'user']
[,[@LoginName =] 'login']
Arguments
-
[
@Action
=]
'
action
'
-
Describes the action to be performed by the procedure.
action is
varchar(10), and can be one of these values.
Value
Description
Auto_Fix
Links user entries in the sysusers table in the current database to logins of the same name in syslogins. It is recommended that the result from the Auto_Fix statement be checked to confirm that the links made are the intended outcome. Avoid using Auto_Fix in security-sensitive situations. Auto_Fix makes best estimates on links, possibly allowing a user more access permissions than intended. user must be a valid user in the current database, and login must be NULL, a zero-length string (‘‘), or not specified.
Report
Lists the users, and their corresponding security identifiers (SID), that are in the current database, not linked to any login. user and login must be NULL, a zero-length string (‘‘), or not specified.
Update_One
Links the specified user in the current database to login. login must already exist. user and login must be specified.
-
[
@UserNamePattern
=]
'
user
'
-
Is the name of a SQL Server user in the current database.
user is
sysname, with a default of NULL.
sp_change_users_login can only be used with the security accounts of SQL Server logins and users; it cannot be used with Microsoft Windows NT® users.
-
[
@LoginName
=]
'
login
'
-
Is the name of a SQL Server login.
login is
sysname, with a default of NULL.
Return Code Values
0 (success) or 1 (failure)
Result Sets
Column name
Data type
Description
UserName
sysname
Login name.
UserSID
varbinary(85)
Login security identifier.
Remarks
Use this procedure to link the security account for a user in the current database with a different login. If the login for a user has changed, use sp_change_users_login to link the user to the new login without losing the user’s permissions.
login cannot be sa, and user cannot be the dbo, guest, or INFORMATION_SCHEMA users.
sp_change_users_login cannot be executed within a user-defined transaction.
Permissions
Any member of the public role can execute sp_change_users_login with the Report option. Only members of the sysadmin fixed server role can specify the Auto_Fix option. Only members of the sysadmin or db_owner roles can specify the Update_One option.
Examples
A. Show a report of the current user to login mappings
This example produces a report of the users in the current database and their security identifiers.
EXEC sp_change_users_login 'Report'
B. Change the login for a user
This example changes the link between user Mary in the pubs database and the existing login, to the new login NewMary (added with sp_addlogin).
--Add the new login.
USE master
go
EXEC sp_addlogin 'NewMary'
go
--Change the user account to link with the 'NewMary' login.
USE pubs
go
EXEC sp_change_users_login 'Update_One', 'Mary', 'NewMary'
Refer:http://msdn2.microsoft.com/zh-cn/library/ms174378.aspx#
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Django 사용자 인증 시스템의 사용자 정의 구현 방법사용자 인증 시스템 사용자 정의 Django가 자체 보유한 사용자 인증 시스템은 이미 대부분의 상황을 만족시킬 수 있지만, 때때로 우리는 특정한 수요를 필요로 한다.Django는 다른 인증 시스템을 사용하거나 Dja...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.