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 <database_name>
GO
sp_changedbowner ‘sa’
GO
OR
USE <database_name>
ALTER AUTHORIZATION ON <database_name>::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.
0 Comments