I get the following error in Replication Monitor:
The row was not found at the Subscriber when applying the replicated UPDATE command for Table '[dgv].[POSCustomer]' with Primary Key =
The error is actually not about the missing row, but that the table's schema says dgv
.
The publication that generated the error is supposed to only replicate to [ppv].[POSCustomer]
, and should not even be aware of [dgv].[POSCustomer]
. And only rows created AFTER the initial snapshot is delivered are affected.
The background:
I'm setting up transactional replication for 3 on-premises databases PPV
, DGV
, and PAC
to a single Azure SQL database.
The three databases belong to different legal entities, on two separate servers (PPV
on one, DGV
and PAC
on another), and have identical schemas.
Tables with the same names from each dbs
are set up to be replicated.
To differentiate them in the target db, I put them in three different schemas using the name of their source dbs, i.e ppv.POSCustomer
, dgv.POSCustomer
, pac.POSCustomer
.
This is done by changing the setting in Publication properties -> Articles -> Article properties -> Destination
object owner.
The initial snapshots are delivered without problems; however, after some time, the row was not found
started showing up in the replication monitor.
I tried re-initializing the subscriptions several times, but the error keeps showing up after the snapshot is delivered.
All rows created after the snapshots are delivered are affected.
The databases are totally isolated from each other, there are no cross database queries, no stored procedures, no triggers that says a record from PPV.dbo.POSCustomer
should be updated in DGV.dbo.POSCustomer
, so I'm at a loss as why this error happened.
I used sp_browsereplcmd
to trace the command that generated the error, which leads me to:
{CALL [sp_MSupd_dboPOSCustomer] (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2019-05-14 00:00:00.000,,27280000.0000,10,,,,,,,,,,,,2019-05-14 18:30:04.000,,,,,,,,,,,,,,,,,,,,N'vinhn4-00001395',0x00000000d000080000)}
which I don't understand, and the sp
is not part of our POS
app.
How can I make this error go away? Manually inserting missing rows will not work, as all new rows are affected. Turning on -skiperrors is not an option. Replicating to different target databases have been done successfully before, but setting up cross database query is such a pain with Azure SQL that I'd prefer to avoid \if possible.