Due to permission issues with a database, a login can fail to honor an update request from dbo.
As part of our Server Support Services here at Ibmi Media, We help our customers regularly to fix SQL related issues.
In this context, we shall look into the cause of this error and how to get rid of it.
More about SQL server error 15150?
One of our customer recently contacted us regarding an SQL 15150 error encountered while trying to update a login from dbo to some other login. The error usually look like this;
Rename failed for User ‘dbo’. (Microsoft.SqlServer.Smo)
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
Cannot alter the user ‘dbo’. (Microsoft SQL Server, Error: 15150)
As earlier stated, this error is triggered when there is database permission issues.
Take note that in the process of updating a user logins, you need to;
i. Check if the the user is part of the dbo database role and if so remove it from this role.
ii. Ensure that the database is assigned to a different user if the user is the owner of the database.
iii. Ensure that full permissions right is assigned to the new user.
How to fix SQL server error 15150?
Fixing this error is very easy. Simply change the default owner to "sa" and then try updating the login to see if it will go through.
Then assign the necessary privileges to the "sa" account of the SQL Server. Use the command below;
ALTER AUTHORIZATION ON <name_of_database>::DATABASE_NAME TO sa