Changing owner for system databases

  • My model db on one of my servers has the owner changed to my personal logon. Generally all databases at my site are owned by sa. I can't figure out how to change it back to sa. exec sp_changedbowner 'sa' doesn't work.  Looking this up in BOL I see 'The owner of the master, model, or tempdb system databases cannot be changed.'  I am assuming this means that sp_changedbowner cannot be used to change the owner of a system db, but there must be another way to do this.  Can I just update sysdatabases so that the sid = the same as other databases with an owner of 'sa'?

    Francis

  • Start sql with trace flag 3608 and you should be able to change the ownership of the database.

  • If sa24's idea does not work, copy and paste the code in sp_changedbowner into your own user sp.  Then locate the test for system databases and remove it.  Your amended sp will then allow you to change ownership of model.  At least, it did for us...

    Original author: https://github.com/SQL-FineBuild/Common/wiki/ 1-click install and best practice configuration of SQL Server 2019, 2017 2016, 2014, 2012, 2008 R2, 2008 and 2005.

    When I give food to the poor they call me a saint. When I ask why they are poor they call me a communist - Archbishop Hélder Câmara

  • Thanks for the help. 

    Francis

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

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