change database owner

  • Hello,

    I am trying to change the database owner and when I run command

    USE database

    EXEC sp_changedbowner 'user'

    GO

    I get error message "Msg 15110, Level 16, State1, Line1

    The proposed new database owner is already a user or aliased in the database."

    I am running SQL 2005 on Windows 2003 with SP1 installed. I installed the application that creates the database and a user but doesn't make that user an owner the database.

    Thanks in advance for any help.

    Zvonimir

  • If the 'user' is already a user in the database, you can't make it the owner. In this case you'll need to remove the user, either through sp_revokedbaccess (old method) or DROP USER (new and preferred method). However, before doing so, if the user owns any schemas, you'll need to transfer them or drop them (if there are no objects in the schema). Once you do all that you can execute sp_changedbowner and change the owner of the database.

    K. Brian Kelley
    @kbriankelley

  • Thanks for your reply. The user actually owns schema. Could you give me an example on how to do that?

  • You can transfer a particular schema to dbo by the following:

    ALTER AUTHORIZATION ON SCHEMA::<schema name> TO dbo

    K. Brian Kelley
    @kbriankelley

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply