You are currently offline, waiting for your internet to reconnect

FIX: The Distribution Agent may skip some rows when you configure a transactional replication that uses the "-SkipErrors" parameter in SQL Server 2005

Extended support for SQL Server 2005 ended on April 12, 2016

If you are still running SQL Server 2005, you will no longer receive security updates and technical support. We recommend upgrading to SQL Server 2014 and Azure SQL Database to achieve breakthrough performance, maintain security and compliance, and optimize your data platform infrastructure. Learn more about the options for upgrading from SQL Server 2005 to a supported version here.

SYMPTOMS
When you configure a transactional replication that uses the -SkipErrors parameter in Microsoft SQL Server 2005, the Distribution Agent may skip some rows. This behavior causes a data inconsistency issue between the publisher and the subscribers.

Additionally, when this problem occurs, the Distribution Agent may display the following messages:
007-05-18 22:49:38.195 The process failed to complete last batch in multi-streaming mode, it has been reset to single connection mode and is retrying the operation.

007-05-18 22:49:38.273 Skipped 1 error(s) when applying transactions at the Subscriber. 007-05-18 22:49:38.367 101 transaction(s) with 100 command(s) were delivered.

007-05-18 22:49:38.477 100 transaction(s) with 100 command(s) were delivered. 007-05-18 22:49:38.570 Skipped 1 error(s) when applying transactions at the Subscriber.

007-05-18 22:49:38.664 100 transaction(s) with 100 command(s) were delivered.
RESOLUTION
The fix for this issue was first released in Cumulative Update 2. For more information about how to obtain this cumulative update package for SQL Server 2005 Service Pack 2, click the following article number to view the article in the Microsoft Knowledge Base:
936305 Cumulative update package 2 for SQL Server 2005 Service Pack 2
Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2005 fix release. Microsoft recommends that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
937137 The SQL Server 2005 builds that were released after SQL Server 2005 Service Pack 2 was released
Microsoft SQL Server 2005 hotfixes are created for specific SQL Server service packs. You must apply a SQL Server 2005 Service Pack 2 hotfix to an installation of SQL Server 2005 Service Pack 2. By default, any hotfix that is provided in a SQL Server service pack is included in the next SQL Server service pack.
STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
MORE INFORMATION
By default, when the Distribution Agent encounters an error, the Distribution Agent should be stopped. If you use the –SkipErrors parameter for specific errors, the Distribution Agent skips those errors and continues to process successive transactions.

Steps to reproduce the problem

  1. Set up a replication environment. To do this, run the following scripts in SQL Query Analyzer.
    use mastergoexec sp_adddistributor  @distributor = @@SERVERNAMEgoexec sp_adddistributiondb  @database = 'distribution'goexec sp_adddistpublisher  @publisher = @@SERVERNAME, @distribution_db = 'distribution'goexec sp_replicationdboption pubdb, publish, falsegoexec sp_replicationdboption subdb, publish, falsegoif db_id('pubdb') is not null    drop database pubdbgocreate database pubdbgoif db_id('subdb') is not null    drop database subdb gocreate database subdbgoexec sp_replicationdboption pubdb, publish, truegouse pubdbgocreate table t(c1 int primary key, c2 int, c3 sysname null, c4 nchar(200) default 'a')gocreate unique index c2_idx on t(c2)gosp_addpublication @publication = 'p1', @status = 'active'gosp_addarticle @publication = 'p1', @article = 'a1', @source_table = 't', @schema_option = 0x00000000000300f3gosp_addsubscription @publication = 'p1', @article = 'all', @subscriber = @@servername, @destination_db = 'subdb'go
  2. Save the following command as a batch file, and then run the file to insert data.
    c: pushd "c:\program files\microsoft sql server\90\com\" del dist.outcall snapshot.exe -publisher %COMPUTERNAME% -publisherdb pubdb -distributor %COMPUTERNAME% -distributorsecuritymode 1 -publication p1call logread.exe -publisher %COMPUTERNAME% -publisherdb pubdb -distributor %COMPUTERNAME% -distributorsecuritymode 1 call distrib.exe -publisher %COMPUTERNAME% -publisherdb pubdb -distributor %COMPUTERNAME% -distributorsecuritymode 1 -publication p1 -subscriber %COMPUTERNAME% -subscriberdb subdb start cmd.exe /s /k "logread.exe -publisher %COMPUTERNAME% -publisherdb pubdb -distributor %COMPUTERNAME% -distributorsecuritymode 1 -continuous"start cmd.exe /s /k "distrib.exe -publisher %COMPUTERNAME% -publisherdb pubdb -distributor %COMPUTERNAME% -distributorsecuritymode 1 -publication p1 -subscriber %COMPUTERNAME% -subscriberdb subdb -subscriptionstreams 8 -SkipErrors 2601:2627 -Output dist.out -OutputVerboseLevel 2 -continuous"popdosql -E -S[SQL_server] -Q"insert subdb..t (c1, c2) values (1000, 1000)"osql -E -S[SQL_server] -Q"insert subdb..t (c1, c2) values (2500, 1015)"osql -E -S[SQL_server] -Q"begin tran declare @v int select @v = 1 while (@v < 1020) begin insert pubdb..t (c1, c2) values (@v, @v) select @v = @v + 1 end commit tran"osql -E -S[SQL_server] -Q"declare @v int select @v = 3100 while (@v < 3500) begin insert pubdb..t (c1, c2) values (@v, @v) select @v = @v + 1 waitfor delay '0:0:0.10' end"
    Note The placeholder SQL_server represents the name of the instance of SQL Server.
  3. Notice that the data has not been replicated to the Subscriber database.
Properties

Article ID: 938671 - Last Review: 08/01/2007 17:52:33 - Revision: 1.4

Microsoft SQL Server 2005 Developer Edition, Microsoft SQL Server 2005 Enterprise Edition, Microsoft SQL Server 2005 Standard Edition, Microsoft SQL Server 2005 Standard X64 Edition, Microsoft SQL Server 2005 Enterprise X64 Edition, Microsoft SQL Server 2005 Standard Edition for Itanium-based Systems, Microsoft SQL Server 2005 Enterprise Edition for Itanium-based Systems

  • kbexpertiseinter kbqfe KB938671
Feedback