LogReader fails with Cannot execute as the database principal because the principal “dbo” does not exist
LogReader fails with error 15517:
2010-02-25 21:16:35.054 Status: 0, code: 20011, text: 'The process could not execute 'sp_replcmds' on 'CHRISSKACER'.'. 2010-02-25 21:16:35.056 The process could not execute 'sp_replcmds' on 'CHRISSKACER'. 2010-02-25 21:16:35.057 Status: 0, code: 15517, text: '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.'. 2010-02-25 21:16:35.058 Status: 0, code: 22037, text: 'The process could not execute 'sp_replcmds' on 'CHRISSKACER'.'.
The SQL Agent was configured to run using ‘ChrisSkAcer\Chris’. In login properties, this account has “system administrator” rights. To eliminate JOB properties or SQL Agent authentication as problem, tried running LogRead.exe from CMD prompt while logged on using the same administrator count.
c>logread.exe –Publisher [CHRISSKACER] –PublisherDB [AdventureWorksLT] –Distributor [CHRISSKACER] –DistributorSecurityMode 1 –continuous
>>same error.
–Connected to Publisher via SSMS and executed LogReader “read” stored proc as ‘sa’
sp_replcmds
>>same error.
–display SQL Server login token (also called Security ID or SID)
select * from sys.login_token
ChrisSkAcer\Chris
0x5EEC29DAFF38CF043B0FFE4AEB030000
–display dbo token in Published database
USE <Published DatabaseName>
GO
select * from sys.user_token
>> dbo 0xA065CF7E784B9B5FE77C87709C280100
–confirms the DBO SID doesn’t match login SID
–Change owner
sp_changedbowner
sp_changedbowner ‘ChrisSkAcer\Chris’
>> error login was already user in the database
–The login was a user, but not DBO
–DROP data base USER ‘ChrisSkAcer\Chris’ and added user back as DBO.
sp_changedbowner ‘ChrisSkAcer\Chris’
Verify User SID
Needed to verify the user_token (SID) not matches the login_in SID used to identify the login when user first connects to SQL Server.
select * from sys.user_token
>> dbo 0x5EEC29DAFF38CF043B0FFE4AEB030000
Now the sys.login_token matches sys.user_token. LogReader connected as DBO and processed commands
even i am facing the same problem!!
I've done following:-
1. Setting up mirroring between two servers
2. Common Distributor database is present in the mirror database
3. Created transaction publication & push subscription in publisher( it was replicating data successfully)
4. Manual failover to other server
5. View snapshot agent tells 'No Replicated transactions'
6. Error in View LogReader Agent Status "Could not restart……….."
7. Issued the command "sp_replrestart"
ERROR MESSAGE 'Cannot execute as the database principal because the principal "dbo" does not exist'
PLZ help me out, stuck with this problem from 2 days
I'hve even checked the sid on both principal & Mirror.. they are same 🙁
I ran into this myself, the answer for me was to run:
ALTER AUTHORIZATION ON DATABASE::[<dbname>] TO [sa]
stackoverflow.com/…/sql-server-2008-replication-failing-with-process-could-not-execute-sp-replcmds
Worked for me.
Thanks a million!
Changing the DB owner to sa worked for me
I have been fighting with this problem for weeks, and changing the DB owner to sa worked for me too. Thank you!
Changing to sa did not work for me. I had to use my own login as owner to get it working. My login is sysadmin.
Note that if you change the Log Reader account, you may have to restart SQL Server. This fixed the problem for me.
Solution:
ALTER AUTHORIZATION ON DATABASE::[<dbname>] TO [sa]