Error 15023 Sql Server 2008
Contents |
SERVER - FIX : Error 15023: User already exists in current database. February 15, 2007Pinal DaveSQL, SQL Performance, SQL Server, SQL Tips and sql server error 15023 user already exists in current database Tricks121 commentsError 15023: User already exists in current database.1) This
Sql Server Error 15023 User Mapping
is the best Solution. First of all run following T-SQL Query in Query Analyzer. sql server error 15138 This will return all the existing users in database in result pan. USE YourDB style="color:red;">'Report' Integration Services 2005 / SSIS (DTS) Reporting Services 2005 Database Design SQL Server User Group SQL Server 2000 VSTS for Database Professionals What I'm Reading .NET Programming drop user from database Microsoft Windows Server GeekLog General News Glossary User Functions Username: Password: Lost your password? Legals Contact Us - Dreaming Boy Technology Refund Policy Terms and Conditions (Including http://blog.sqlauthority.com/2007/02/15/sql-server-fix-error-15023-user-already-exists-in-current-database/ Terms of Use) Privacy Policy advanced search How to fix: User, group, or role '*' already exists in the current database. (Microsoft SQL Server, Error: 15023) If you've restored a database onto another server, you may get the following error message when adding user logins to the database: Create failed for User 'TMS'. (Microsoft.SqlServer.Smo) User, http://www.julian-kuiters.id.au/article.php/sql-server-user-already-exists group, or role 'TMS' already exists in the current database. (Microsoft SQL Server, Error: 15023) To fix this there are two different methods depending on the version of SQL Server you are using. Both of these commands re-map the user's Security Identifier (SID) to match the sql server login's SID. SQL Server 2008 / SQL Server 2008 R2 If you have already created the server login for the user, run this in the database with the login problem. (Change 'user'to be the database username you wish to fix, and 'serverlogin' is the sql server login to map the user to). ALTER USER user WITH LOGIN = serverlogin For full details of the ALTER USER command see MSDNhttp://msdn.microsoft.com/en-us/library/ms176060.aspx SQL Server 2005 / SQL Server 2000 If you have already created the server login for the user, run this in the database with the login problem. (Change 'user' to be the username you wish to fix). EXEC sp_change_users_login 'Auto_Fix', 'user' Your Twitter Handle About Us SSG Team Join Us Authors Speakers Blog With Us Write a Guest Post Testimonials Contact Us Subscribe to our Newsletter http://www.sqlservergeeks.com/sql-server-error-15023-user-already-exists-in-current-database/ Blogs All Blog Posts One DMV a Day Series Accidental DBA Series One Operator a Day Series One Trace Flag a Day Series Videos Events PodCasts Newsletters Resources Social Twitter Facebook Page Facebook Group RSS YouTube LinkedIn Google+ Submit Your Twitter Handle About Us SSG Team Join Us Authors Speakers Blog With Us Write a Guest Post Testimonials Contact Us Subscribe to our sql server Newsletter SQL Server error 15023 User already exists in current database HomeSQL ServerTransact-SQLSQL Server Accidental DBA SeriesDatabase AdministrationSQL Server error 15023 User already exists in current database Previous Next SQL Server error 15023 User already exists in current database The SQL Server error 15023 User already exists in current database occurs when a databases is restored from another instance. The database users aren’t mapped sql server error to the corresponding logins at the instance where it is restored and are termed as orphaned users. When one tries to login to the restored database with an orphan user we get message as “login failed for
GO
EXEC sp_change_users_login Sql Server 2012 User Already Exists In The Current Database
Run following T-SQL Query in Query Analyzer to associate login with the username. ‘Auto_Fix' attribute will create the user in SQL Server instance if it does not exist. In following example ‘ColdFusion' is UserName, ‘cf' is Password. Auto-Fix links a user entry in alter user user with login = server login the sysusers table in the current database to a login of the same name in sysxlogins. USE YourDB
GO
EXEC sp_change_users_login 'Auto_Fix', 'ColdFusion', NULL, 'cf'
GO
Run following T-SQL Query in Query Analyzer to associate login with the username. ‘Update_One' links the specified user in the current database to login. login must already exist. user and login must be specified. password must be NULL or not specified USE YourDB
GO
EXEC sp_change_users_login 'update_one', 'ColdFusion', 'ColdFusion'
GO
2) If login account has permission to drop other users, run following T-SQL in Query Analyzer. This will drop the user. USE YourDB
GO
EXEC sp_dropuser 'ColdFusion'
Sql Error 15025The Server Principal Already Exists