When setting up SQL Server replication you might see an error message from the Transactional Replication Log Reader Agent which reads like the following.
- The process could not execute ‘sp_replcmds’ on ”. (Source: MSSQL_REPL, Error number: MSSQL_REPL20011)
Get help: http://help/MSSQL_REPL20011
- 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. (Source: MSSQLServer, Error number: 15517)
Get help: http://help/15517
- The process could not execute ‘sp_replcmds’ on ”. (Source: MSSQL_REPL, Error number: MSSQL_REPL22037)
Get help: http://help/MSSQL_REPL22037
Often this error message can come from the database not having a valid owner, or the SQL Server is not being able to correctly identify the owner of the database. Often this is easiest to fix by changing the database owner by using the sp_changedbowner system stored procedure as shown below. The sa account is a reliable account to use to change the ownership of the database to.
EXEC sp_changedbowner ‘sa’
Once the database ownership has been changed the log reader will probably start working right away. If it doesn’t quickly restarting the log reader should resolve the problem.
While this does require changes to the production database, there is no outage required to make these changes.
Dangit! I’ve been bit by this – never thought of that. Many thanks, MrDenny.
Massive thank you for this, super helpful!
Can you by chance offer any assistance on a 608 error? I have the published DB partitioned on a date column (getdate()) and retain the data for 4 days. The subscriber DB is not partitioned. I have the publisher “allow_partition_switch” = true and “repleate_ddl”= false and last “replicate_partition_switch”=false. Every night when my sql job runs I stop the log reader, waitfor delay ’00:00:05′ and continue with table switching. At the end I merge the old date(partition 1) off and split in the next date. All this is correct but I still get that dang 608 error. Any idea?
Not sure what would be causing that. We’d have to take a look at it to figure out what’s causing the issue. Feel free to hit the Get In Touch button above and we can setup a call.
Just found this and it solved my issue. Thanks again, Denny, Monica, Joey and everyone else.