Database Error 15410
Contents |
create new user 0 I was in SSMS creating a new user using the SSMS GUI. This is for a user who will be doing some contract work for us. My boss wants user or role does not exist in this database. me to give him just the ability to create/edit views and SPs. So, grant db_owner to user sql server using the GUI I selected the databases he's to have access to, and then I made sure that only public
Sp_addrolemember Db_owner
was selected as a database role membership. For one of the databases I was surprised to see that db_owner was also selected. I have no idea why that would be, and I
Sql Server Dbo Permissions
certainly don't want to give him that role membership. When I clicked the button to create a new SQL account I got the following error for that database: User or role '' does not exist in this database. (Microsoft SQL Server, Error: 15410) I've got a couple of questions about this. First, what does this error mean (my searches haven't yielded good results), and why change db owner sql 2012 would this database automatically want to add the user to that database role membership? more ▼ 0 total comments 1012 characters / 175 words asked May 24, 2010 at 01:53 PM in Default Rod 801 ● 48 ● 51 ● 55 add new comment (comments are locked) 10|1200 characters needed characters left ▼ Everyone Moderators Original poster and moderators Other... Viewable by all users 3 answers: sort voted first ▼ oldest newest voted first 0 Usually the GUI is pretty good about this sort of thing, but it sounds like you haven't created the user yet. You have to have a login on the server that you then map to users in the database that you then grant permissions. I usually create roles with the permissions I want and then attach users to the roles. It's just easier. more ▼ 1 total comment 336 characters / 63 words answered May 24, 2010 at 03:06 PM Grant Fritchey ♦♦ 137k ● 20 ● 43 ● 81 Actually, I did create the user at the server level first, before attempting to add the user to the databases we want to give him access to. I hadn't
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 site About Us Learn more about Stack Overflow the company Business
User Or Role Does Not Exist In This Database Azure
Learn more about hiring developers or posting ads with us Database Administrators Questions Tags Users sql server db owner permissions Badges Unanswered Ask Question _ Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their grant dbo to all databases database skills and learn from others in the community. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise https://ask.sqlservercentral.com/questions/7869/got-error-15410-when-attempting-to-create-new-user.html 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 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 http://dba.stackexchange.com/questions/54389/sql-server-grant-user-dbo-permission-on-database 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,1522748 That makes sense - I didn't know there was a distinction between login and user. Thanks –OrangeGrover Dec 3 '13 at 23:45 2 See this answer to a different question where I explain the login/user relationship in a little more detail. –Mike Fal Dec 4 '13 at 0:35 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a gues
... does not exist in this database - Error - Using sp_addrolemember User or role ... does not exist in this database - http://dbaspot.com/ms-sqlserver/231712-user-role-does-not-exist-database-error-using-sp_addrolemember.html Error - Using sp_addrolemember Hi all, Using SQL 2000 OK I'm going crazy here trying to give a login database access and adding them to a role. Should be very simple. In EM http://stackoverflow.com/questions/21409509/sql-server-restore-and-user-permission it is!! Just trying to do the same thing in a query. I have a Windows NT Login in SQL called 'Mydomain\snoopy I'm missing something? this is what I'm trying to run: sql server USE MyDatabase GO EXEC sp_grantdbaccess 'Mydomain\snoopy, 'snoopy' GO EXEC sp_addrolemember 'db_datareader', 'Mydomain\snoopy' I get this error message: Granted database access to 'Mydomain\snoopy'. Server: Msg 15410, Level 11, State 1, Procedure sp_addrolemember, Line 66 User or role 'Mydomain\snoopy' does not exist in this database. But it should be there I just added with sp_grantdbaccess? thanks gv Re: User or role ... does not exist in this user or role database - Error - Using sp_addrolemember gv Did you run ? This example creates a SQL Server login for the user snoopy, with a password of food and a default database of mydbname EXEC sp_addlogin 'snoopy', 'food', 'mydbname' This example adds the user snoopy to the existing 'dbrole' in the current database, using the existing login snoopy . EXEC sp_adduser 'snoopy', 'snoopy', 'dbrole' "gv"
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_in