3

I got an error message in my Log Reader Agent:

The process could not execute 'sp_replcmds' on 'Database Name'.

I created another agent profile with a large query timeout and a min value to batch, but it still doesn't work.

Can someone help me?

I'm using SQL Server 2008 and I'm trying to do a replication between databases on different servers.

Joe Stefanelli
  • 132,803
  • 19
  • 237
  • 235
Lucas Germano
  • 31
  • 1
  • 1
  • 2
  • possible duplicate of [SQL Server 2008 replication failing with: process could not execute 'sp_replcmds'](http://stackoverflow.com/questions/2723061/sql-server-2008-replication-failing-with-process-could-not-execute-sp-replcmds) – Joe Stefanelli Jul 02 '12 at 15:06
  • Have a look at this http://stackoverflow.com/questions/2723061/sql-server-2008-replication-failing-with-process-could-not-execute-sp-replcmds?rq=1 – Mattias Nordqvist Jan 17 '13 at 09:55

3 Answers3

3

It could be possible that owner of the database could be someone other than what you have permissions for. Below there's a simple command to change ownership...if you have the rights to do so.

--TSQL Code--
USE PublishedDatabase
GO
EXEC sp_changedbowner 'sa'
GO
Jason Geiger
  • 1,912
  • 18
  • 32
Bobby
  • 77
  • 1
  • 10
  • I was receiving this error. I did a couple of things including this. I then stopped and restarted the Log Reader Agent and it started working. I wonder if there was some issue with the ownership that this cleared up. It may have been something else but all signs point to this fixing an ownership issue. Well done! – Jason Geiger Jan 23 '20 at 19:37
1

This could be due to Owner is not set for the database.

You can check by right clicking on database then choose Property and go to File Table and the Owner selection should be there.

zapping
  • 4,118
  • 6
  • 38
  • 56
1

There are a lot of things that can cause this error (which include, but is not limited to):

  • The database has been publication disabled
  • The account trying to run the log reader agent doesn't have the ability connect to the publisher server
  • The account trying to run the log reader agent doesn't have permission to run sp_replcmds

In my experience, there's a little more to the error in the replication monitor. Is this the case for you?

Ben Thul
  • 31,080
  • 4
  • 45
  • 68
  • 1
    Error messages: The process could not execute 'sp_replcmds' on 'database_name'. (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 'database_name'. (Source: MSSQL_REPL, Error number: MSSQL_REPL22037) Get help: http://help/MSSQL_REPL22037 – Lucas Germano Sep 22 '11 at 18:24
  • Who is the database owner of the database? Check both the owner_sid in sys.databases and suser_sname(sid) from sys.database_principals where name = 'dbo'. If either of those "looks funny" (sorry, it's hard to be more specific), that could be your problem. – Ben Thul Sep 23 '11 at 14:46