Sunday, June 12, 2011

Database Owner - Error Message


Sometimes, a simple task that as a DBA you do day in and day out,
can throw wierd errors.

You right click on a database and click on Properties to check
the Database Size/ Database path. Suddenly, a error message as shown
below is thrown at you.



The error message says the problem is with the database owner. When the database owner is removed ( perhaps the login was dropped ) , such a error message is thrown.The problem can be rectified by using the command


EXEC MASTER.dbo.Sp_changedbowner 'sa'
GO 

The command sets database owner as dbo and solves the problem. Now we can comfortably view database property from SSMS as usual.

Please note that sp_changedbowner command is marked for depcreation and users are recommended to use ALTER AUTHORIZATRION command.syntax is provided below.

ALTER AUTHORIZATION ON DATABASE::dbname TO principal;

For more details on AUTHORIZATION refer here

No comments: