Property Owner is not available for Database

Couple of days back, on one of the databases encountered a strange error. When clicked on Properties of the database in SSMS, it threw an error which read

****************

Property Owner is not available for Database ‘[DatabaseName]‘. This property may not exist for this object, or may not be retrievable due to insufficient access rights.  (Microsoft.SqlServer.Smo)

****************

sp_helpdb executed successfully. However for that particular database, the owner field was NULL.

Now the root cause has been found. Since the database owner was NULL, SSMS was unable to display the properties of the database. We have already pushed a Change Control which will execute sp_changedbowner ‘sa’ against that database. This is the permanent fix for this issue.

How did the Database Owner name change to NULL? Here is an example.

Let us make a Windows Login the database owner for ownertest database.

CREATE LOGIN [ADIGA\testdbownerissue] FROM WINDOWS WITH DEFAULT_DATABASE=[ownertest]
go

use ownertest
go
sp_changedbowner 'ADIGA\testdbownerissue'
go

Now let us delete that login from the Operating System /Active Directory (not at the instance). Now the output of sp_helpdb ownertest looks like this

This concludes that the Database Owner value changed to NULL because the Windows Account was removed from the Active Directory, without changing the DBOwner for the database for which this account was holding the ownership. This usually happens when a database owner leaves the organization and the database owner is not changed accordingly.