Skipping Errors in Replication

Issue:
The row was not found at the Subscriber when applying the replicated UPDATE (any DML command) command for Table '[dbo].[table_name]' with Primary Key(s): [domain] = <Domain_name> , [role_id] = xyz, [user_id] = xyz (Source: MSSQLServer, Error number: 20598)


Solution :-

Run this on Publisher:- 

      To get error message & sequence number

     USE distribution 
     GO

     DECLARE @PublisherServer  VARCHAR(50), 
             @PublicationDB    VARCHAR(50), 
             @SubscriberServer VARCHAR(50), 
             @SubscriberDB     VARCHAR(50), 
             @PublicationName  VARCHAR(50) 

     SET @PublisherServer   = 'PublisherServerName
     SET @PublicationDB     = 'PublicationDBName
     SET @SubscriberServer  = 'SubscriberServerName
     SET @SubscriberDB      = 'SubscriberDBName
     SET @PublicationName   = 'PublicationName

     EXEC Sp_helpsubscriptionerrors 
          @PublisherServer, 
          @PublicationDB, 
          @PublicationName, 
          @SubscriberServer, 
          @SubscriberDB 
     GO 

Output :-
xact_seqno
0x00093CD100060356000B00000000
0x00093CD100060356000B00000000
0x00093CD100060356000B00000000

Run this on subscriber:-

       To skip error

     DECLARE @PublisherServer VARCHAR(50), 
             @PublicationDB   VARCHAR(50), 
             @PublicationName VARCHAR(50) 

     SET @PublisherServer  = 'PublisherServerName'
     SET @PublicationDB    = 'PublicationDBName
     SET @PublicationName  = 'PublicationName

     EXEC Sp_setsubscriptionxactseqno 
          @PublisherServer, 
          @PublicationDB, 
          @PublicationName, 
          0x0009371A000605F0000900000000 


Note :- Before skipping error cross verify which row/column causing issue , If needed update it on replication.


No comments:

Post a Comment