Msg 15150 – Cannot Alter The User ‘dbo’.

Anonymous
2025-04-08T16:35:57.0133333+00:00

Getting this error message - "Msg 15150 – Cannot Alter The User ‘dbo’." When using SSMS -> Login Properties -> User Mapping to change/modify the schema owner from 'dbo' to another user.

Instead of using this approach, I went with T-SQL using this command:-

=================================================================

use [dbname]

exec sp_changedbowner 'new-dbuser'

go

Commands completed successfully. Completion time: 2025-04-08T08:19:57.3508306-04:00

==================================================================

I get the confirmation above. However, when I checked the Using SSMS -> Login Properties -> User Mapping, it is still showing 'dbo'. Thus, this SP_CHANGEDBOWNER is NOT does what is supposed to do.

Is there a workaround?

Your input is greatly appreciated - THANK YOU!

Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. Adithya Prasad K 1,375 Reputation points Microsoft External Staff Moderator
    2025-04-08T17:10:03.7666667+00:00

    Hi Vince Husenajr
    It seems like you're encountering a common issue when trying to change the schema owner from 'dbo' to another user in SQL Server. The error message "Msg 15150 – Cannot Alter The User ‘dbo’" indicates that the operation you're attempting is not allowed directly through the SSMS interface.
    To resolve this issue, you can follow these steps:
    Change the Database Owner to 'sa':

    • One effective workaround is to change the database owner to 'sa' (the system administrator account). This can be done using the following T-SQL command:
        USE [dbname]
        EXEC sp_changedbowner 'sa'
        GO
      
    • This command changes the database owner to 'sa', which should allow you to modify the user mappings as needed Verify the Change:
      • After executing the command, verify that the database owner has been changed by checking the properties of the database in SSMS.
        Reassign Ownership:
        • If you need to assign the ownership to a different user, you can now do so without encountering the error. Use the following command to change the owner to your desired user:
        USE [dbname]
        EXEC sp_changedbowner 'new-dbuser'
        GO
      
      SQL SERVER – FIX: Msg 15150 – Cannot Alter The User ‘dbo’:
      • This blog post provides a detailed explanation of the error and suggests changing the default owner to 'sa' as a solution
      I would request you to refer the below mentioned links for more information
      https://blog.sqlauthority.com/2017/12/12/sql-server-fix-msg-15150-cannot-alter-user-dbo/
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.