Microsoft sql server ошибка 15150

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.

  • Remove From My Forums
  • Question

  • 1.Created a new Login-«ADMIN»

    2. Created a new Database «TEST1»

    Now, I’m trying to alter the User to ‘ADMIN’ in the ‘USER MAPPING’ but get the following error- «Cannot alter user ‘dbo’ Error:-15150»

    I read couple of related topics but it does not give me a step by step process. Can you please provide me the steps and syntax properly as Im new to SQL Server.

Answers

  • To expand on that, if you want a login to be an administrator, the database login joins the sysadmin fixed server role. Or, if you don’t want the login to be an administrator of the entire SQL Server, but do want the user to be in charge of a
    database, the database user joins the dbowner fixed database role.


    Microsoft, SQL Server Books Online

    • Marked as answer by

      Friday, May 28, 2010 11:03 AM

  • If there are any more problems, please let me know.
    Thanks.


    ***Xiao Min Tan***Microsoft Online Community***

    • Marked as answer by
      Alex Feng (SQL)
      Friday, May 28, 2010 11:03 AM

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.

  • Remove From My Forums
  • Question

  • 1.Created a new Login-«ADMIN»

    2. Created a new Database «TEST1»

    Now, I’m trying to alter the User to ‘ADMIN’ in the ‘USER MAPPING’ but get the following error- «Cannot alter user ‘dbo’ Error:-15150»

    I read couple of related topics but it does not give me a step by step process. Can you please provide me the steps and syntax properly as Im new to SQL Server.

Answers

  • To expand on that, if you want a login to be an administrator, the database login joins the sysadmin fixed server role. Or, if you don’t want the login to be an administrator of the entire SQL Server, but do want the user to be in charge of a
    database, the database user joins the dbowner fixed database role.


    Microsoft, SQL Server Books Online

    • Marked as answer by

      Friday, May 28, 2010 11:03 AM

  • If there are any more problems, please let me know.
    Thanks.


    ***Xiao Min Tan***Microsoft Online Community***

    • Marked as answer by
      Alex Feng (SQL)
      Friday, May 28, 2010 11:03 AM

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)

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)

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;

Use <name_of_database>
GO
sp_changedbowner ‘sa’
GO
USE <name_of_database>
ALTER AUTHORIZATION ON <name_of_database>::DATABASE_NAME TO sa

Need support in fixing SQL errors? We are here to help you.

Содержание

  1. SQL Server 2016 — Error 15150 trying change usermapping
  2. 1 Answer 1
  3. Related
  4. Hot Network Questions
  5. Subscribe to RSS
  6. SQL server error 15150
  7. What is SQL server error 15150?
  8. Procedure for updating the logins
  9. How to fix SQL error 15150?
  10. Conclusion
  11. How to fix SQL server error 15150
  12. More about SQL server error 15150?
  13. How to fix SQL server error 15150?
  14. Need support in fixing SQL errors? We are here to help you .
  15. Conclusion
  16. Sql server error 15150
  17. Answered by:
  18. Question
  19. The login already has an account under a different user name
  20. 3 Answers 3

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 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

1 Answer 1

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.

Hot Network Questions

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.1.14.43159

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

SQL server error 15150

by Jilu Joseph | Sep 7, 2020

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
GO
sp_changedbowner ‘sa’
GO

USE
ALTER AUTHORIZATION ON ::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.

Источник

How to fix SQL server error 15150

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;

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;

Need support in fixing SQL errors? We are here to help you .

Conclusion

When trying to update a login from dbo to some other login due to permissions issues with the database, an SQL server error 15150 occurs .

Источник

Sql server error 15150

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

We’ve one windows user account, which is directly associated with ‘dbo’ user.

What I mean by the above is:
When you look at the logins you would see this user as ‘Domainsiva’ when you look for this user in the database user list, you won’t find this windows account there.
When you double click ‘dbo’ from the user list, you would see it’s associated with the ‘Domainsiva’ login.

When you go to login properties for this account and grant access to that particular database (under User Mapping), ther ‘user’ column shows ‘dbo’ rather than ‘Domainsiva’. Even if you type ‘Domainsiva’ in the ‘user’ column, it gives an error saying,

«Rename failed for user ‘dbo’.
Cannot alter the user ‘dbo’ (error 15150)

I want to reduce the permissions for this user ‘Domainsiva’. But not able to take him out of ‘dbo’ and put in data_reader role.

Anybody has any ideas to correct this?

I don’t know how this account got created/associated with ‘dbo’.
While it’s in development, the user ‘domainsiva’ may have created and nobody noticed how it got associated but now the problems comes..

Источник

The login already has an account under a different user name

When I execute this SQL:

I get the following error:

The login already has an account under a different user name.

How do I know what this different user name is for my login account?

3 Answers 3

This means that the login [R2ServerAAOUser] is already mapped to a user in that database. Or, in other words, another database user is using this login. You can see what database user is using your login with the following query:

PS: a version of the script that doesn’t use the compatibility views:

It’s a ‘metadata thing’ .

Sometimes the database user gets ‘corrupted’ over the course of whatever is going on in that DB. (I’ve seen similar behavior if the DB gets restored, and the roles in the restored copy differ from what the one you overlaid contained. This is why I tried below, which fixed the problem for me.)

Open up the Login properties in SSMS —> (Security | Logins | failing UserID | Properties | User Mapping). You’ll probably see the DB’s already checked and has Roles assigned (like perfectly normal).

Note the permissions on the DB giving the error, just for reference.

  • Uncheck that DB and save the login.
  • Now re-run your query to add the Login/Role into the target DB. It should work just fine.
  • Источник

    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

    asked Dec 12, 2017 at 12:43

    Douglas Ferreira's user avatar

    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.

    answered Dec 12, 2017 at 12:51

    M.Y.Mnu's user avatar

    1

    • Remove From My Forums
    • Question

    • I want to drop a schema but it shows Fail to drop schema — Error 15150.
      I found that there is no object under the schema.  Any idea?  Thanks in advnace

    Answers

    • The following query should show what objects exist under the schema foo

      select name from sys.objects where schema_id = schema_id(‘foo’)

      union

      select name from sys.types where schema_id = schema_id(‘foo’)

      union

      select name from sys.xml_schema_collections where schema_id = schema_id(‘foo’)

      Some schemas are undroppable: sys, dbo, information_schema

      hth,

      -Steven Gott

      S/DET

      SQL Server

    • Remove From My Forums
    • Question

    • I want to drop a schema but it shows Fail to drop schema — Error 15150.
      I found that there is no object under the schema.  Any idea?  Thanks in advnace

    Answers

    • The following query should show what objects exist under the schema foo

      select name from sys.objects where schema_id = schema_id(‘foo’)

      union

      select name from sys.types where schema_id = schema_id(‘foo’)

      union

      select name from sys.xml_schema_collections where schema_id = schema_id(‘foo’)

      Some schemas are undroppable: sys, dbo, information_schema

      hth,

      -Steven Gott

      S/DET

      SQL Server

    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

    asked Dec 12, 2017 at 12:43

    Douglas Ferreira's user avatar

    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.

    answered Dec 12, 2017 at 12:51

    M.Y.Mnu's user avatar

    1

    Some times we may get the below error while updating the login from dbo to some other login from user mapping window.

    1. I have database which is mapped with dbo login and dbo schema. 
    2. I tried to update the database with app_user login, then it displays below error:




    Cannot alter the user ‘dbo’. (Microsoft SQL Server, Error: 15150)

    To fix this issue we need to change the default owner to ‘sa’ and then tried to update the login. 

    Use database_name
    sp_changedbowner ‘sa’

    Понравилась статья? Поделить с друзьями:
  • Microsoft office ошибка 1335
  • Microsoft office ошибка 0 2035
  • Microsoft office обновляется и выдает ошибку
  • Microsoft office непредвиденная ошибка
  • Microsoft office код ошибки 30175 4