Article ID: 938671
Article Last Modified on 8/1/2007
APPLIES TO
- 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
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:
RESOLUTION
To resolve this problem, obtain cumulative update package 2 (build 3175) for SQL Server 2005 Service Pack 2. For more information about this cumulative update package, 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 is available
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
Set up a replication environment. To do this, run the following scripts in SQL Query Analyzer.
use master go exec sp_adddistributor @distributor = @@SERVERNAME go exec sp_adddistributiondb @database = 'distribution' go exec sp_adddistpublisher @publisher = @@SERVERNAME, @distribution_db = 'distribution' go exec sp_replicationdboption pubdb, publish, false go exec sp_replicationdboption subdb, publish, false go if db_id('pubdb') is not null drop database pubdb go create database pubdb go if db_id('subdb') is not null drop database subdb go create database subdb go exec sp_replicationdboption pubdb, publish, true go use pubdb go create table t(c1 int primary key, c2 int, c3 sysname null, c4 nchar(200) default 'a') go create unique index c2_idx on t(c2) go sp_addpublication @publication = 'p1', @status = 'active' go sp_addarticle @publication = 'p1', @article = 'a1', @source_table = 't', @schema_option = 0x00000000000300f3 go sp_addsubscription @publication = 'p1', @article = 'all', @subscriber = @@servername, @destination_db = 'subdb' go
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.out call snapshot.exe -publisher %COMPUTERNAME% -publisherdb pubdb -distributor %COMPUTERNAME% -distributorsecuritymode 1 -publication p1 call 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" popd osql -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.- Notice that the data has not been replicated to the Subscriber database.
Keywords: kbexpertiseinter kbqfe KB938671