Tech Blog‎ > ‎

MS SQL Server 2008 R2 Error Log Growing Rapidly

posted Oct 11, 2011, 12:21 PM by Victor Zakharov   [ updated Oct 20, 2011, 7:45 AM ]
MS SQL server 2008 R2 was spamming the error log with the following two messages (got around 50GB of them in 4 days):

A) An exception occurred while enqueueing a message in the target queue. Error: 15517, State: 1. Cannot execute as the database principal because the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission.

B) The activated proc '[dbo].[SqlQueryNotificationStoredProcedure-xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx]' running on queue 'DATABASE_NAME.dbo.SqlQueryNotificationService-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' output the following:  'Cannot execute as the database principal because the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission.'

I solved (A) by recreating/re-enabling broker:
ALTER DATABASE <DBNAME> SET DISABLE_BROKER
ALTER DATABASE <DBNAME> SET NEW_BROKER
ALTER DATABASE <DBNAME> SET ENABLE_BROKER
A database restart was needed right before executing the queries, otherwise it hung.
Also restarted after applying to verify those messages were gone in the new log file.

Problem (B) is described here:
Solution: sp_changedbowner 'NEW_USER'
Comments