Mostrando entradas con la etiqueta dbo does not exist. Mostrar todas las entradas
Mostrando entradas con la etiqueta dbo does not exist. Mostrar todas las entradas

miércoles, 25 de enero de 2012

SQL SERVER - FIX - REPLICATION ERROR: Cannot execute as the database principal because the principal "dbo" does not exist

I was dealing with a replication issue, the Log Reader Agent was failing with the following messages:

Error messages:
The process could not execute 'sp_replcmds' on 'ServerName'. (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 'ServerName'. (Source: MSSQL_REPL, Error number: MSSQL_REPL22037)
Get help: http://help/MSSQL_REPL22037

In several forums you will see a discussions about it, but most of them didn't provide a final solution for it.

The solution for it is really simple:

ALTER AUTHORIZATION ON DATABASE::[DatabaseName] TO sa 

The reason is, the DB was restored from another environment or was restored from an old SQL Version.