How do I change the owner login? RRS feed

  • Question

  • I have a VM set up which I changed the server's computer name after sql server was installed. The owner/creator of all my databases (both before and after the name change) have the login 'SERVER_NAME-1\Administrator'

    It doesn't seem to be stopping me from doing anything, but I've noticed a bunch of errors being written to the event log:
    "Could not obtain information about Windows NT group/user 'SERVER-NAME-1\Administrator'

    I've had a look in the SQL database and run sp_dropserver 'SERVER-NAME-1', and sp_addserver 'SERVER-NAME-2', local
    This sorts out that @@SERVERNAME returns the correct name, but running SELECT name, SUSER_SNAME(owner_sid) FROM sys.databases still shows the owners of all my databases as SERVER-NAME-1.

    I can't modify the login directly, and I can't add a new login as it says it's already added.

    What can I do to stop these errors from happening?


    Oh, I also have active directory on the VM, which was installed after SQL server
    Monday, December 21, 2009 2:03 PM

All replies

  • Managed it!
    I was trying to add the new login using my domain rather than the new computer name. Once I'd added the new login to sql I changed each databases owner using the sp_changedbowner 'SERVER-NAME-2\Administrator' command
    Monday, December 21, 2009 2:13 PM
  • can you try to change the ownership of databases and objects to any other login and then try dropping the login ?
    The ownership of a database can be changed by sp_changedbowner.

    Try changing the ownership to sa , then drop the old login and finally add the new login from windows.

    Thanks, Leks
    Monday, December 21, 2009 2:14 PM
  • Hmmm... that's not got rid of the error message in the log, now it just mentions the 'SERVER-NAME-2\Administrator' instead. Darn...
    Monday, December 21, 2009 2:15 PM