locked
Null for db owner RRS feed

  • Question

  • I tried to look into db properties, and I've got the error that property owner is not available. I've ran sp_helpdb, and found bunch of databases with db_owner as null. How can I change the db owner?
    JulieShop
    Wednesday, November 3, 2010 5:38 PM

Answers

  • Please always tell us what version you are using.

    This can happen when the database is owned by a Windows login that is no longer available, or by a Domain Login and the network is inaccessible.

    You might consider having databases owned by a SQL login, such as sa, that will always be available.

    You can change the owner using the ALTER AUTHORIZATION command.

    Here are the details:

    http://msdn.microsoft.com/en-us/library/ms187359.aspx


    HTH, Kalen Delaney www.SQLServerInternals.com
    Wednesday, November 3, 2010 6:03 PM

All replies

  • >>How can I change the db owner?

    You can change database owner by

    ALTER AUTHORIZATION ON Database::<databaseName> TO <serverPrincipal>
    
    
    

     <databaseName>  name of the databae you want to change owner

    <serverPrincipal> name of the principal  or sql server login

    Wednesday, November 3, 2010 5:51 PM
  • Please always tell us what version you are using.

    This can happen when the database is owned by a Windows login that is no longer available, or by a Domain Login and the network is inaccessible.

    You might consider having databases owned by a SQL login, such as sa, that will always be available.

    You can change the owner using the ALTER AUTHORIZATION command.

    Here are the details:

    http://msdn.microsoft.com/en-us/library/ms187359.aspx


    HTH, Kalen Delaney www.SQLServerInternals.com
    Wednesday, November 3, 2010 6:03 PM
  • is there any query i can run to find out all orphan databases? except sp_helpdb
    JulieShop
    Wednesday, November 3, 2010 6:33 PM
  • sql server 2005
    JulieShop
    Wednesday, November 3, 2010 6:36 PM
  • is there any query i can run to find out all orphan databases? except sp_helpdb
    JulieShop
    The query below should give you all databases without an owner
    SELECT name, SUSER_SNAME(owner_sid)
    FROM sys.databases WHERE owner_sid is null
    Wednesday, November 3, 2010 6:43 PM