SQL server error 15150 occurs when while updating the login from dbo to some other login due to incorrect ownership of the database.
Here at Bobcares, we have seen several such SQL related issues as part of our Server Management Services for web hosts and online service providers.
Today we’ll take a look at the cause for this error and see how to fix it.
What is SQL server error 15150?
Often, customers may encounter an SQL error 15150 while updating the login from dbo to some other login from the user mapping window. The error looks like,
~~~
Rename failed for User ‘dbo’. (Microsoft.SqlServer.Smo)
——————————
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
——————————
Cannot alter the user ‘dbo’. (Microsoft SQL Server, Error: 15150)
~~~
Mostly, this error occurs due to wrong database ownership.
Procedure for updating the logins
Thee are some rules that need to ensure before update the user logins.
1. Importantly, if the user is a member of the dbo database role, then the user has to remove from this role.
2. Also, if the user is the database owner, then, the user hast to change the database owner to another user.
3. Afterward, update the permissions needed for the new user. Or create a database role that includes the permissions and put the user in that role.
How to fix SQL error 15150?
To fix this issue, we need to change the default owner to ‘sa’ and then try to update the login.
Moreover, the ‘sa’ account of SQL Server has the special privileges necessary to manage the database. So, this ‘sa’ default account is administrative.
By default, this account is disabled to avoid unauthorized access to the database.
Use
GO
sp_changedbowner ‘sa’
GO
OR
USE
ALTER AUTHORIZATION ON ::DATABASE_NAME TO sa
[Need any further assistance in fixing SQL errors? – We’re available 24*7]
Conclusion
In short, SQL server error 15150 happens when updating the login from dbo to some other login due to incorrect ownership of the database. Today, we saw how our Support Engineers fix this SQL error.
- Remove From My Forums
-
Question
-
We’ve one windows user account, which is directly associated with ‘dbo’ user.
What I mean by the above is:
When you look at the logins you would see this user as ‘Domain\siva’ when you look for this user in the database user list, you won’t find this windows account there.
When you double click ‘dbo’ from the user list, you would see it’s associated with the ‘Domain\siva’ login.When you go to login properties for this account and grant access to that particular database (under User Mapping), ther ‘user’ column shows ‘dbo’ rather than ‘Domain\siva’. Even if you type ‘Domain\siva’ in the ‘user’ column, it gives an error saying,
«Rename failed for user ‘dbo’……………..
Cannot alter the user ‘dbo’ (error 15150)I want to reduce the permissions for this user ‘Domain\siva’. But not able to take him out of ‘dbo’ and put in data_reader role.
Anybody has any ideas to correct this?
I don’t know how this account got created/associated with ‘dbo’….
While it’s in development, the user ‘domain\siva’ may have created and nobody noticed how it got associated but now the problems comes..Any ideas?
Thanks,
Siva.
Answers
-
Hi,
if the user is member of the dbo database role, you will first have to remove him from this role. If he is the database owner, you will first have to change the database owner to another user. Then afterwards you can grant thim indivually the permissions needed, or create a database role which includes the permissions and put him in that role. This will be much more easier, if you have additional users holding the same rights as the mentioned user.
HTH, Jens K. Suessmeyer.
—
http://www.sqlserver2005.de
— -
First
Use sp_changedbowner to a new user and you should be able to delete that particular user.
- Remove From My Forums
-
Вопрос
-
login account Tester to create database TesterDB
then login sa or Tester
Database -> TesterDB -> Security -> Schemas -> Add new Scheme called noio
Outer side
Security -> Login -> Tester -> User Mapping -> TesterDB -> Change default schema to noioAlter failed for User ‘dbo’ Error 15150
would like to know how to operate in user interface to change scheme dbo to another name
reach one variable gcd, mgcd begin to write
Ответы
-
Hi,
Try and change the database owner to something else, for example, sa, then repeat what you did…
Thanks,
Andrew Bainbridge
SQL Server DBAPlease click «Propose As Answer» if a post solves your problem, or «Vote As Helpful» if a post has been useful to you
-
Помечено в качестве ответа
17 мая 2012 г. 8:07
-
Помечено в качестве ответа
- Remove From My Forums
-
Question
-
1.Created a new Login-«ADMIN»
2. Created a new Database «TEST1»
Now, I’m trying to alter the User to ‘ADMIN’ in the ‘USER MAPPING’ but get the following error- «Cannot alter user ‘dbo’ Error:-15150»
I read couple of related topics but it does not give me a step by step process. Can you please provide me the steps and syntax properly as Im new to SQL Server.
Answers
-
To expand on that, if you want a login to be an administrator, the database login joins the sysadmin fixed server role. Or, if you don’t want the login to be an administrator of the entire SQL Server, but do want the user to be in charge of a
database, the database user joins the dbowner fixed database role.
Microsoft, SQL Server Books Online
-
Marked as answer by
Friday, May 28, 2010 11:03 AM
-
Marked as answer by
-
If there are any more problems, please let me know.
Thanks.
***Xiao Min Tan***Microsoft Online Community***
-
Marked as answer by
Alex Feng (SQL)
Friday, May 28, 2010 11:03 AM
-
Marked as answer by
I’m trying to add db_backupuperator to a UserMapping but I can’t. It returns the Error 15150 and the message:
«Drop failed for User ‘dbo’ (Microsoft.SqlServer.Smo)
Additional information:
an exception occurred while executing a Transact-SQL statment or batch
(Microsoft.SqlServer.ConnectionInfo)»
I’ve already tried apply these sugested solutions:
https://blog.sqlauthority.com/2017/12/12/sql-server-fix-msg-15150-cannot-alter-user-dbo/
Use database_name
sp_changedbowner 'sa'
I’ve tried also delete the database and create a new one, but then I can’t edit any option of User Mapping, can’t even add db_datareader or db_datawriter
asked Dec 12, 2017 at 12:43
If the user is member of the dbo database role, you will first have to remove him from this role. If he is the database owner, you will first have to change the database owner to another user. Then afterwards you can grant thim indivually the permissions needed, or create a database role which includes the permissions and put him in that role. This will be much more easier, if you have additional users holding the same rights as the mentioned user.
Reference link from Here.
Glorfindel
22k13 gold badges81 silver badges109 bronze badges
answered Dec 12, 2017 at 12:51
1
I tried this command
Use database_name; EXEC sp_changedbowner 'sa';
then I’m able to change database user.
answered Aug 10 at 15:03
Mohammed OsmanMohammed Osman
3,6982 gold badges27 silver badges25 bronze badges