Douglas Ferreira
Douglas Ferreira

Reputation: 514

SQL Server 2016 - Error 15150 trying change usermapping

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

Upvotes: 3

Views: 25638

Answers (2)

M.Y.Mnu
M.Y.Mnu

Reputation: 718

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.

Upvotes: 5

Mohammed Osman
Mohammed Osman

Reputation: 4246

I tried this command Use database_name; EXEC sp_changedbowner 'sa'; then I'm able to change database user.

Upvotes: 2

Related Questions