태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.

닷넷프레임워크 딥 다이브 - .NET Framework Deep Dive

SEARCH RESAULT : 글 검색 결과 - 2009/11 (총 1개)

POST : SQL Server

[MSSQL Server 2008 SSMS] Error 15023 User or role already exists in the current database

개발을 하다보면 데이터베이스를 연결하는 경우가 있습니다.

데이터베이스 파일 자체에 기존의 로그인 계정이 존재하지만, 데이터베이스 인스턴스의 로그인과 매핑이 되어야  새로 연결한 데이터베이스에 로그인 하여 사용할 수 있습니다.

SSMS로 인스턴스에 매핑할 사용자를 만들었는데

Error 15023 User or role already exists in the current database

에러 메세지를 낼때가 있습니다.

 인스턴스의 계정과 기존의 데이터베이스에 있는 계정이 매핑에 실패하였을 때 발생하며, 새쿼리 창을 띄워서 아래의 명령을 실행 시키면 문제가 해결 됩니다.

exec sp_change_users_login Update_One, 'MyLogin', 'MyLogin'

솔루션 해결에 대한 블로그 포스트
Error 15023 User or role already exists in the current database

You may run into the 15023 error if you restore a MS SQL database from backup.  You expect a restored database to be in exactly the same state as the backup, but the login fails for a user that had permissions in the backed up database.  When you use the "User Mapping" SQL Management Studio functionality to allow the user permissions to the new database, you receive the 15023 error.  This is caused by Security identification numbers (SID) that are mismatched or 'orphaned' in the sysusers table. 

The SQL Server stored proc sp_change_users_login locates and fixes these records.  Run it with a single parameter 'Report' to get a listing of abandoned user names and corresponding SIDs:

exec sp_change_users_login Report

The 'Update_One' parameter will reconnect a single login:

exec sp_change_users_login Update_One, 'MyLogin', 'MyLogin'

You can find more info about this issue at:

http://support.microsoft.com/kb/246133

http://support.microsoft.com/kb/240872

This next blog expands on the available parameters for sp_change_users_login:

http://blog.sqlauthority.com/2007/02/15/sql-server-fix-error-15023-user-already-exists-in-current-database/

Also, try checking out the source for sp_change_users_login found in the Sql Server Management Studio under Databases | System Databases | Master | Programmability | Stored Procedures | sp_change_users_login.

저작자 표시
top

tags

, ,

posted at

2009/11/24 15:13


CONTENTS

닷넷프레임워크 딥 다이브 - .NET Framework Deep Dive
BLOG main image
닷넷 프레임워크 .NET FRAMEWORK, C# .NET 과 프레임워크 디자인, 아키텍처 설계, ASP.NET 개발 - 인간과 정보의 상호작용에 통찰력을 얻기 위한 블로그 입니다. -성공률이 100%인 프로젝트가 있다고? 거기에는 혁신이 0%일 것이다. ,Google CEO 에릭슈미트
RSS 2.0
공지
아카이브
최근 글 최근 댓글 최근 트랙백
카테고리 태그 구름사이트 링크