Error/Fix: The database owner SID recorded in the master database differs from the database owner SID recorded in database

Spread the love

Recently I received an incident for low disk space on mount point dedicated to system databases on development sql server. So I started checking SQL Server Error logs to find out what’s filling up the msdb database, and encountered multiple occurrences of error message similar to below:-

The activated proc ‘[dbo].[SqlQueryNotificationStoredProcedure-ac5720fb-f6f2-4df7-b6ca-6845b4c71d1a]’ running on queue DEV_SERVER_01.dbo.SqlQueryNotificationService-ac5720fb-f6f2-4df7-b6ca-6845b4c71d1a’ output the following: ‘The database owner SID recorded in the master database differs from the database owner SID recorded in database ‘MY_DEV_DB01’. You should correct this situation by resetting the owner of database ‘MY_DEV_DB01′ using the ALTER AUTHORIZATION statement.’

Resolution:
As suggested by error message, this problem is logged when SID of the database owner does not match with SID of owner registered in master database. This could occur after DBA forgets to fix database owner after database refresh. So, I googled further, and found below URL that had multiple solutions by SQL Server experts:-
https://stackoverflow.com/questions/12389656/the-database-owner-sid-recorded-in-the-master-database-differs-from-the-database

For me, below solution provided by Stefan Steiger worked perfectly.

After resolving the SID mismatch issue, I went forward to recycle the SQL Server Error log files with below TSQL code till enough space could be freed on mount point.

Friends, please feel free to correct me by comments. If you like the article, do Like & Share. Happy Coding 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.