One of my clients was deploying SharePoint and they were following some documents to make sure it is as per their standard deployment. They were seeing below error while updating the login from dbo to some other login from user mapping window (for login properties window). Let us learn how to fix error 15150 about cannot alter the user.
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)
When I ran on script option, here was the output
USE [DBODB] GO ALTER USER [dbo] WITH NAME=[DB1] GO
To fix this issue we need to change the default owner to ‘sa’
Use <database_name> GO sp_changedbowner 'sa' GO
Well, this looks very simple but indeed a very crucial blog. I see this error every single day with my customer and today I decided to write a blog post about it.
There are a few other blogs related to this blog post are listed here:
- SQL SERVER – Forgot the Password of Username SA
- SQL SERVER – Change Password of SA Login Using Management Studio
- SQL SERVER – Fix – Login failed for user ‘username’. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)
Reference: Pinal Dave (https://blog.sqlauthority.com)