SQL Server synchronous replication troubleshooting method, SQL Server
1. the row cannot be found on the subscription server when the command copied by the application is run.
Solution: Use System stored proceduresSp_browsereplcmds(Return the result set of the readable version Copy command stored in the distribution database and use it as a diagnostic tool. This stored procedure is executed on the distribution server for the distribution database)
sp_browsereplcmds [ [ @xact_seqno_start = ] 'xact_seqno_start' ] [ , [ @xact_seqno_end = ] 'xact_seqno_end' ] [ , [ @originator_id = ] 'originator_id' ] [ , [ @publisher_database_id = ] 'publisher_database_id' ] [ , [ @article_id = ] 'article_id' ] [ , [ @command_id= ] command_id ] [ , [ @agent_id = ] agent_id ] [ , [ @compatibility_level = ] compatibility_level ]
Troubleshooting: distribution DB (distribution) on the distribution server)
Use [distribution] go -- a, general transaction serial number, find the execution statement EXEC sp_browsereplcmds @ xact_seqno_start = '0x00044ed500008f3e00ab000000000000' for command_id = 1 ', @ xact_seqno_end = '0x00044ed500008f3e00ab00000000 '-- view the synchronization object table (locate the article_id field value in the above result set) select * From MSarticles where article_id = 344
-- The following two situations may occur in the 1st statements (a/B)
-- A. The row cannot be found during the update.
{CALL [dbo]. [sp_MSupd_dbo table name] (...)}
-- B. The row cannot be found during deletion.
{CALL [dbo]. [sp_MSdel_dbo table name] (...}
Learn about the synchronization stored procedure:
Solution (a, update, B, delete): Add missing data rows on the subscription end (add a record based on the error ID above) or use the Import and Export method (the above ID is synchronously specified by the SQL statement ). (cause: An error occurred while deleting or updating data rows could not be found due to the lack of data lines on the subscription end)
-- C. Error in addition
{CALL [dbo]. [sp_MSins_dbo table]
Solution (c. An error occurred when adding the table): An error occurred when adding the table. The solution may be caused by the identity value, the fact that the primary key ID is already in (deleting the data row on the subscription end), or the table structure is not worth it.