Thursday, July 9, 2015


My replication is not distributing data to subscriber

_________________________________________________

The other day I was talking to my friend who was having issue with distribution is not distributing data to the subscriber. What should I do?

I asked him if he has checked distribution database -

use  [distribution]
go
SELECT * FROM msrepl_commands
WHERE xact_seqno =   0x0000A21C00000539000400000000

From the output do this -

EXEC SP_BROWSEREPLCMDS
@xact_seqno_start = '0x0000A21C000005390004',
@xact_seqno_end =  '0x0000A21C000005390004',
@publisher_database_id = 8 

Notice if there are command like this

CALL [dbo].[sp_MSdel_dbositeSetting] (10545)}
or 
CALL [dbo].[sp_MSins_dbositeSetting] (10642,183,'productid','277','Global',2015-07-08 10:38:00,2015-07-08 10:38:00,1)
Or 
CALL [dbo].[sp_MSupd_dbositeSetting] (289278,{5C87AA5F-4F62-4B26-9860-43AA3EBB4867},277,6003,1,17162,NULL,4,'Deleting Again',NULL,NULL,NULL,'~/again-delete',NULL,0,0,0,0,0,0,0,0,0,0,0,1,NULL,NULL,914,1,2014-10-07 17:30:00,2014-10-07 17:31:00,NULL,NULL,NULL,NULL,0,0,0,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,289278)

What does they mean ?
There are 3 SP in the subscribers as for Delete, Insert and Update. For some reason they are failing to perform it.
For example, Delete probably couldn't anything to delete on the subscribe table. 
Why not? - Some how data got delete from subscriber - It could be a user deleted it, trigger deleted it ...
Same for Update. And Insert, could find that data is already in the distribution for any reason.


What can I do, he asked me?

You can confirm that both publisher and subscriber to make sure about the above issue. 

use publisher
go
sp_helptext sp_MSdel_dboSiteSetting
go
select *  from  Your Publisher.[dbo].[SiteSetting] where [SiteSettingID] = 10642
select *  from  Your Subscriber.[dbo].[SiteSetting] where [SiteSettingID] = 10642

Then?

If you have valid reason you can remove them from the Distribution DB table

delete  FROM msrepl_commands
WHERE xact_seqno = 0x0000A21C00000531002700000000
and command_id = 3

Note:

If your environment is having know issue that people are doing these delete/update/insert on the subscriber (which they should not) you can set your replication  as 


Let me know about your experience related to this.