Nathan's profileNates StuffPhotosBlogListsMore Tools Help

Blog


    October 29

    Restoring a SQL Server 2005 Database On A Different Machine

    If you do a lot of programming on a SQL 2005 database, chances are this has happened to you!  You restore a database and try to diagram it (or make some other change) and get this error:
    SQLError
    TITLE: Microsoft SQL Server Management Studio Express
    ------------------------------
    Database diagram support objects cannot be installed because this database does not have a valid owner.  To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects.
    ------------------------------
    BUTTONS:
    OK
    ------------------------------


    What a pain!  Here is how you fix it!
    • Open up a new query window
    • Execute the command:
      • ALTER AUTHORIZATION ON Database::[MY_DATABASE_NAME] TO [MY_USER_NAME]
        • Replace [MY_DATABASE_NAME] with the name of your database
        • Replace [MY_USER_NAME] with a valid user in your system but one that does not yet exist in the restored database
        • Example:  ALTER AUTHORIZATION ON Database::CorporateDB TO sa

    I hope this helps someone!  It's not as easy to change as I think it should be!

    Nathan Zaugg

     
    UPDATE:
     
    Another possible fix is found if you are geting the error "The proposed new database owner is mapped as a user in this database"
     
    USE MyDatabase
    EXEC sp_addlogin
    'TempOwner'
    EXEC sp_changedbowner
    'TempOwner'
    EXEC sp_changedbowner
    'sa'
    EXEC sp_droplogin 'TempOwner'

    October 19

    Windows Live Writer

    I am testing out this new blogging software called Windows Live Writer.  It comes as an add-on to the Windows Messenger Beta along with some other stuff that looks pretty interesting including an Internet Safety application.  It also included something called "Live Mail" which is a windows application for Hotmail/MSN.  I have tried the Live Mail before and I would rather just keep it on the Internet -- especially sense it doesn't have any extra functionality. 

    The blog writer is pretty cool though.  It spell checks my blogs and unlike using MS Word, I can spell check and style as I go rather than having to apply the style once I have pasted the "raw" test in to the screen.

    This is my first blog post with the software, but I do expect to give it a pretty high rating.  The only "bummer" is that my guess is that it works best with Windows Live Spaces.

    Nathan Zaugg