Problem.
Error: Property Owner is not available for Database '[DB_NAME]'.
This property may not exist for this object, or may not be retrievable
due to insufficient access rights. (Microsoft.SqlServer.Smo)
This a common error that happens when we try to access the database options and the database doesn�t have owner. The database can not be an owner because somebody clean the owner property, or the user (owner) was deleted, etc.
Solution / Fix / Workaround.
Is necessary to assign a proper owner for the database. To know what are the valid owners for the database, we can execute the following query:
select databases.name,server_principals.name
from sys.[databases]
inner join sys.[server_principals]
on [databases].owner_sid = [server_principals].sid
To assign the owner for the database:
USE <SID>
Go
sp_changedbowner '
Go
EmoticonEmoticon