question

luggg avatar image
luggg asked

Replication errors in initializing subscriber

I configured replication on SQL Server 2012 according to Microsoft technet turorials http://technet.microsoft.com/en-us/library/aa337475.aspx http://technet.microsoft.com/en-us/library/aa337437.aspx I have distributor, publisher and subscriber all on the same SQL Server instance for a test. The errors are The process could not execute 'sp_replcmds' on 'HOMSAR\WULU2012'. (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 'HOMSAR\WULU2012'. (Source: MSSQL_REPL, Error number: MSSQL_REPL22037) Get help: http://help/MSSQL_REPL22037 I checked the databases on the instance with select name ,suser_sname(owner_sid) owner from sys.databases All databases has a valid owner, and the repl_logreader Windows login has db_owner role in publisher, subscriber and distribution databases. In Profiler I see sp_replcmds was executed by user sa. Run the same command in SSMS exec sp_replcmds 500,0,-1,0x,0,0,500000 go Got error: Msg 15517, Level 16, State 1, Procedure sp_replcmds, Line 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. I appreciate any comments and suggestions.
replication
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

KenJ avatar image KenJ commented ·
is the owner 'sa'? if not, just for the fun of it, run `sp_changedbowner 'sa'` in each database. This error is seems to almost always be related to problems with the account that owns the database, even when it's not replication specific. Sometimes it *is* a valid account, just not one that the server recognized. You may have read this msdn blog post, but I'll link it just in case - http://blogs.msdn.com/b/repltalk/archive/2010/02/26/logreader-fails-with-cannot-execute-as-the-database-principal-because-the-principal-dbo-does-not-exist.aspx
0 Likes 0 ·

1 Answer

·
luggg avatar image
luggg answered
KenJ, Thank you for comments. I tried as you suggested: use [CoreDB-SVRIA-DX] go sp_changedbowner 'sa' go use [subs_coredb_dx] go sp_changedbowner 'sa' go Now got error: The process could not execute 'sp_repldone/sp_replcounters' on 'HOMSAR\WULU2012'. (Source: MSSQL_REPL, Error number: MSSQL_REPL20011) Get help: http://help/MSSQL_REPL20011 Only one Log Reader Agent or log-related procedure (sp_repldone, sp_replcmds, and sp_replshowcmds) can connect to a database at a time. If you executed a log-related procedure, drop the connection over which the procedure was executed or execute sp_replflush over that connection before starting the Log Reader Agent or executing another log-related procedure. (Source: MSSQLServer, Error number: 18752) Get help: http://help/18752 The process could not set the last distributed transaction. (Source: MSSQL_REPL, Error number: MSSQL_REPL22017) Get help: http://help/MSSQL_REPL22017 The process could not execute 'sp_repldone/sp_replcounters' on 'HOMSAR\WULU2012'. (Source: MSSQL_REPL, Error number: MSSQL_REPL22037) It appears to be a good progress. Now what is the best way to stop the current running Log Reader. Just stop replication job?
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

KenJ avatar image KenJ commented ·
That would probably do it. I think there is a list of agents in the replication monitor where you might be able to shut off the log reader. How many times have you set up replication? If it's more than one, there could be a orphaned sql agent job out there you need to stop and remove.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.