Error 15410 Sql Server
Contents |
(Русский)ישראל (עברית)المملكة العربية السعودية (العربية)ไทย (ไทย)대한민국 (한국어)中华人民共和国 (中文)台灣 (中文)日本 (日本語) HomeLibraryLearnDownloadsTroubleshootingCommunityForums Ask a question Quick access Forums home Browse forums users FAQ Search related threads Remove From My Forums Answered by: Getting a "User or role '[DomainUsersAccess]' does not error 15410 sql server 2008 exist in this database." error SQL Server > SQL Server Express sql error msg 15410 Question 0 Sign in to vote I've got a SQL Server 2008 R2 Express database. We're working on grant db_owner to user sql server a WPF app, that's going to use this database, which will be installed on each users' desktop/laptop. We want it so that access to the SQL Express database will
Sql Server Dbo Permissions
be handled by Windows authentication, so if a domain user is logged in he/she can access the data. The database is named ASI. The plan is to create a new role, assign the db_datareader and db_datawriter roles to this new role, associate a user in SQL for all domain users and associate the new, custom role with all domain sql server db owner permissions users. We've got a group in our AD named "Domain Users", and that's what I was going to associate with the user in SQL. However, I'm getting an error trying to do this, I don't have to give a lot of lines to illustrate where the error occurs. Here's the SQL: USE ASI GO CREATE ROLE [DomainUsersAccess] --give my new role appropriate permission to ALL tables EXEC sp_addrolemember N'db_datareader', N'[DomainUsersAccess]' EXEC sp_addrolemember N'db_datawriter', N'[DomainUsersAccess]' The error occurs on the 2 calls (I'm getting 2 error messages, and they're identical) to sp_addrolemember. The error reads as follows: Msg 15410, Level 11, State 1, Procedure sp_addrolemember, Line 75 User or role '[DomainUsersAccess]' does not exist in this database. Msg 15410, Level 11, State 1, Procedure sp_addrolemember, Line 75 User or role '[DomainUsersAccess]' does not exist in this database. In looking at my ASI database, I can clearly see that the new role DomainUsersAccess is in it. So, why is the sp_addrolemember stored procedure complaining? What am I doing wrong? Rod Monday, July 15, 2013 9:04 PM Repl
log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this sp_addrolemember db_owner site About Us Learn more about Stack Overflow the company Business Learn more
User Or Role Does Not Exist In This Database.
about hiring developers or posting ads with us Database Administrators Questions Tags Users Badges Unanswered Ask Question _ Database Administrators
Change Db Owner In Sql Server 2012
Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute: Sign https://social.msdn.microsoft.com/Forums/sqlserver/en-US/55f08311-ea4b-485e-8d8f-3dbf7f7ca13a/getting-a-user-or-role-domainusersaccess-does-not-exist-in-this-database-error?forum=sqlexpress up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top SQL-Server - Grant user DBO permission on database up vote 9 down vote favorite 2 I have a reporting database that I restore every night from a backup of the production database. When I restore, I need to add a user http://dba.stackexchange.com/questions/54389/sql-server-grant-user-dbo-permission-on-database to the DBO role for that database. I thought this would work: use Restored_Prod go exec sp_addrolemember 'db_owner', 'chris' go But I get the following error, since that user doesn't exist in the Restored_Prod database: Msg 15410, Level 11, State 1, Procedure sp_addrolemember, Line 75 User or role 'chris' does not exist in this database. How do I add the user 'chris' to the database to be able to run the sp_addrolemember to make him a DBO of that database? Is there a way to add the user permissions using sp_addrolemember command from the master db where the user exists? sql-server-2008-r2 permissions share|improve this question asked Dec 3 '13 at 23:13 OrangeGrover 92138 add a comment| 1 Answer 1 active oldest votes up vote 19 down vote accepted User principals must exist in a database before you can grant them permissions. use Restored_Prod GO CREATE USER [chris] FROM LOGIN [chris]; exec sp_addrolemember 'db_owner', 'chris'; GO http://technet.microsoft.com/en-us/library/ms173463.aspx share|improve this answer answered Dec 3 '13 at 23:23 Mike Fal 8,1822748 That makes sense - I didn't know there was a distinction between login and user. Thanks –OrangeGrover Dec 3 '13 at 23:45 2 S
Procedure sp_addrolemember, Line 75 User or role ‘mydomain\JShah' does not exist in this database. Cause Login already has an account under a https://sqldbpool.com/2009/07/22/msg-15410-level-11-state-1/ different user name on particular database. For example mydomain\JShah user is http://stackoverflow.com/questions/21409509/sql-server-restore-and-user-permission mapped to database as user name jshah Solution ALTER USER [jshah] WITH NAME=[mydomain\jshah] execute sp_AddRoleMember ‘DBRole','mydomain\jshah' OR We can pass the actual user name execute sp_AddRoleMember ‘DBRole','jshah' Share this:Share on Facebook (Opens in new window)Click to share on Tumblr (Opens in new window)Click to share on LinkedIn sql server (Opens in new window)Click to share on Reddit (Opens in new window)Click to print (Opens in new window)Click to share on Twitter (Opens in new window)Click to email (Opens in new window)Click to share on Google+ (Opens in new window)Click to share on Pinterest (Opens in new window)Like this:Like Loading... Related This entry was posted in SQL Server and error 15410 sql tagged Errors. Bookmark the permalink. Post navigation ← Msg 15063, Level 16, State1 Insert Extended Character using OSQLUtility → Thanks for the comment, will get back to you soon... Jugal Shah Cancel reply Enter your comment here... Fill in your details below or click an icon to log in: Email (required) (Address never made public) Name (required) Website You are commenting using your WordPress.com account. (LogOut/Change) You are commenting using your Twitter account. (LogOut/Change) You are commenting using your Facebook account. (LogOut/Change) You are commenting using your Google+ account. (LogOut/Change) Cancel Connecting to %s Notify me of new comments via email. Notify me of new posts via email. About MeJugal Shah is the author of this blog. He has 12 plus years of experience as Database Administrator and Developer in the Microsoft SQL Server and MySQL. Chat IMSQLDBPool@gmail.com Server Server MVP (2010, 2011, 2012 and 2013) SQLDBPool facebook Page SQLDBPool facebook Page Search @ SQLDBPOOL Search Click to subscribe to this blog Enter your email address to subscribe to this blog and receive notifications
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up SQL server restore and user permission up vote 0 down vote favorite I need to permission a user to a database right after a database restore. I tried this: Use [master] go restore database DBTest from disk='E:\userTemp\DBTest1.bak' WITH MOVE 'DBTest' TO 'E:\SQLData\DBTest1.mdf', MOVE 'DBTest_log' TO 'F:\SQLData\DBTest1.ldf', replace, recovery, stats=5, maxtransfersize=1048576 Print '---------------------------RESTORE COMPLETED ---------------------------' -- Create the user. CREATE USER [user_indi] FOR LOGIN [user_indi] GO USE [DBTest] GO EXEC sp_addrolemember N'db_owner', N'user_indi' GO When I do this, I get the following error: Msg 15023, Level 16, State 1, Line 22 User, group, or role 'user_indi' already exists in the current database. Msg 15410, Level 11, State 1, Procedure sp_addrolemember, Line 75 User or role 'user_indi' does not exist in this database. So, what added the command to remove the user in the middle. Now it looks like this. Use [master] go restore database DBTest from disk='E:\userTemp\DBTest1.bak' WITH MOVE 'DBTest' TO 'E:\SQLData\DBTest1.mdf', MOVE 'DBTest_log' TO 'F:\SQLData\DBTest1.ldf', replace, recovery, stats=5, maxtransfersize=1048576 Print '---------------------------RESTORE COMPLETED ---------------------------' -- Remove the user USE [DBTest] GO DROP USER [user_indi] GO -- Create the user. CREATE USER [user_indi] FOR LOGIN [user_indi] GO USE [DBTest] GO EXEC sp_addrolemember N'db_owner', N'user_indi' GO Now, I get the error: Msg 15151, Level 16, State 1, Line 2 Cannot drop the user 'user_indi', because it does not exist or you do not have permission. I can't allow errors as I need to schedule this restore and permission job. Why am I getting this error and how can I workaround it? RM sql sql-server permissions restore share|improve this question edited Jan 28 '14 at 15:45 marc_s 452k938641029 asked Jan 28 '14 at 15:17 user1666952 76112 Your USE [DBTest] statements are in two different places. In the first one, you're attempting to create the user in MASTER. In the