debugsqlModerate
SQL Server 2008 R2 error: 15023, user, group, or role already exists
Viewed 0 times
error2008groupsqluserrolealready15023existsserver
Problem
I have a test database that I'm having permissions issues with.
I can't access the reporting database, and the application's help documentation says to do the following:
When I do this, I get the following error:
I have googled this error and tried the following command on each database:
The message indicated that the commands completed successfully but I am still getting the above error when I try to map each database as instructed above.
What am I missing?
Per Kin's comment (thanks) I tried this:
Thoughts??
I can't access the reporting database, and the application's help documentation says to do the following:
Resolution:
1. Launch the SQL Server Management Studio and connect to the database server(s) hosting the Vision and Reporting Server databases.
2. Expand the security folder.
3. Select logins and right click on the user and choose properties.
4. Click the User Mapping tab
5.Make sure the following databases are selected in the Users mapped to this Login:
ReportServer
ReportServerTempDB
Your Vision databases
This maps the login/user to the respective databases.
6. As you select each database (including your Vision database), select the db_owner role in the Database role membership for: section. You must select this option for each database.When I do this, I get the following error:
"Create failed for user '\'. User, group, or role '\' already exists in the current database. (Microsoft SQL Server, Error: 15023)"I have googled this error and tried the following command on each database:
ALTER USER [] WITH LOGIN = []The message indicated that the commands completed successfully but I am still getting the above error when I try to map each database as instructed above.
What am I missing?
Per Kin's comment (thanks) I tried this:
- I right clicked the user and selected: Script Login As > Drop and Create To > New query window.
- I ran the resulting query and tried to map the user roles by selecting the other two databases and db_owner again but I am still getting the same error message as above.
Thoughts??
Solution
There are a number of things you can try, and the success of each will probably depend on what server role you have.
For starters, if it is just one or two users then honestly, the easiest way is to drop the database user from the restored database, and providing there is an existing server login already, remap the database user to the server login using SSMS. If the server login does not exist then just create it, map the user, and presto! Away we go.
Next option: If you are migrating a large number of users, use sp_help_revlogin. sp_help_revlogin is a Microsoft supplied stored procedure that will help migrate logins from one server to another, including passwords and SIDs. Here is a good article about it SP_HELP_REVLOGIN
For starters, if it is just one or two users then honestly, the easiest way is to drop the database user from the restored database, and providing there is an existing server login already, remap the database user to the server login using SSMS. If the server login does not exist then just create it, map the user, and presto! Away we go.
Next option: If you are migrating a large number of users, use sp_help_revlogin. sp_help_revlogin is a Microsoft supplied stored procedure that will help migrate logins from one server to another, including passwords and SIDs. Here is a good article about it SP_HELP_REVLOGIN
Context
StackExchange Database Administrators Q#56011, answer score: 12
Revisions (0)
No revisions yet.