Changing the database’s owner – Best practice and How to change the owner of a database…

It is always a good practice to keep database’s owner to a standard user which does not belong to a human being (preferabbly sa).

This practice eliminates your database from loosing a owner in case the actual owner leaves the organazation and his/her user account is deleted from active directory. Typically you will see database owner as “Null” if the actual database owner no longer exist in the system. Hence changing database owner to a standard non-human account is regarded as a best practice.

To change owner of a database, please use below code:

EXEC [DATABASE NAME].dbo.sp_changedbowner @loginame = N'OWNER ID'

Here we are changin the owner of database Test to sa

EXEC [Test].dbo.sp_changedbowner @loginame = N'sa'