Showing posts with label replicating. Show all posts
Showing posts with label replicating. Show all posts

Wednesday, March 21, 2012

Row operation cannot be reapplied

Hi,

I'm merge replicating between SQL Server 2005 and SQL Compact on mobile devices. This has been running reasonably well, after a lot of setup problems, but recently I've noticed an error when a new subscription synchronizes with the server (creating a new database on the device). After running for several minutes, the synchronization stops with the following error:

"The row operation cannot be reapplied due to an integrity violation. Check the publication filter. [Table = AppUser,Operation = Insert,RowGuid = ..."

There are no filters on the publication. The record causing the problem already exists on the server and is apparently being added to the new database on the subscriber, but it seems the merge agent is trying to add the record twice. I've tried doing a new snapshot and then immediately synchronizing, but still the same error. Has anyone come across this problem when synchronizing, especially with a new database/subscription?

Regards,

Greg

This error is created because of an integrity issue in you table schema. I had the same problem where I had created a foreign key relationship from one table to 2 fields in the joined table. For example:

My replication filtered on employee name (or HOST_NAME())

This employee table field existed in 2 fields of the joined table, ie: records could be sent to 2 subscriptions based on 2 fields in the record table which related to the employee table.

I had to delete the FK relationship in the database, and just kept the relationship in the filtered join in the replication. This solved the error.

|||

I encountered the problem too. Is the limitation of compact edition doesn't support FK relationship in the table?

Anyone had worked around the issue?

Jun

|||No, sql compact database supports fk relationships just fine. Replication, however, is very particular about the schema of the replicated tables. When setting up the replication be sure you know whether relationships are 1 to many, 1 to 1, or many to many. Any deviation from this will cause this or other errors. For example in my case I had 1 table FK relate to 2 fields in another table, although this schema can be fine in a normal production database, when replicated, it makes it hard for the replication to keep track of GUIDs and other replication objects. So I just deleted one of the relationships and kept the other.|||

I am having a very similar issue - how did you get the error message to include the actual table, guid, etc. My error message is as follows:

The row operation cannot be reapplied due to an integrity violation. Check the Publication filter. [,,,Table,Operation,RowGuid] (Source: MSSQLServer, Error number: 28549)

I have a filter using HOST_NAME() as well with your typical FK's 1 field in one table to 1 field in another.

I am under the gun to get this app out and I just can not get enough details on this error to resolve, any help would be greatly appreciated.

Thanks,
Daniel

|||Since your error is not specifying a certain table, you'll have to test it 1 relationship at a time starting with the main filter relationship. Drop the relationship in the production database, re-create snapshot and reinitialize subscriptions until you've removed the errored relationship. Then re-examine your schema to determine why the error happened and see if you can re-design the relationship. Good luck.|||

Wow, there is no way to turn on additional logging that would produce a more detailed error message?

Row operation cannot be reapplied

Hi,

I'm merge replicating between SQL Server 2005 and SQL Compact on mobile devices. This has been running reasonably well, after a lot of setup problems, but recently I've noticed an error when a new subscription synchronizes with the server (creating a new database on the device). After running for several minutes, the synchronization stops with the following error:

"The row operation cannot be reapplied due to an integrity violation. Check the publication filter. [Table = AppUser,Operation = Insert,RowGuid = ..."

There are no filters on the publication. The record causing the problem already exists on the server and is apparently being added to the new database on the subscriber, but it seems the merge agent is trying to add the record twice. I've tried doing a new snapshot and then immediately synchronizing, but still the same error. Has anyone come across this problem when synchronizing, especially with a new database/subscription?

Regards,

Greg

This error is created because of an integrity issue in you table schema. I had the same problem where I had created a foreign key relationship from one table to 2 fields in the joined table. For example:

My replication filtered on employee name (or HOST_NAME())

This employee table field existed in 2 fields of the joined table, ie: records could be sent to 2 subscriptions based on 2 fields in the record table which related to the employee table.

I had to delete the FK relationship in the database, and just kept the relationship in the filtered join in the replication. This solved the error.

|||

I encountered the problem too. Is the limitation of compact edition doesn't support FK relationship in the table?

Anyone had worked around the issue?

Jun

|||No, sql compact database supports fk relationships just fine. Replication, however, is very particular about the schema of the replicated tables. When setting up the replication be sure you know whether relationships are 1 to many, 1 to 1, or many to many. Any deviation from this will cause this or other errors. For example in my case I had 1 table FK relate to 2 fields in another table, although this schema can be fine in a normal production database, when replicated, it makes it hard for the replication to keep track of GUIDs and other replication objects. So I just deleted one of the relationships and kept the other.|||

I am having a very similar issue - how did you get the error message to include the actual table, guid, etc. My error message is as follows:

The row operation cannot be reapplied due to an integrity violation. Check the Publication filter. [,,,Table,Operation,RowGuid] (Source: MSSQLServer, Error number: 28549)

I have a filter using HOST_NAME() as well with your typical FK's 1 field in one table to 1 field in another.

I am under the gun to get this app out and I just can not get enough details on this error to resolve, any help would be greatly appreciated.

Thanks,
Daniel

|||Since your error is not specifying a certain table, you'll have to test it 1 relationship at a time starting with the main filter relationship. Drop the relationship in the production database, re-create snapshot and reinitialize subscriptions until you've removed the errored relationship. Then re-examine your schema to determine why the error happened and see if you can re-design the relationship. Good luck.|||

Wow, there is no way to turn on additional logging that would produce a more detailed error message?

Monday, March 12, 2012

row filter where clause (busy db performance hit?)

Hello.
I need to setup a filter for a really busy db
that we are replicating. I was wondering what
type of filter to use. I am afraid that the
where clause of a row filter will create a major
performance hit. I was looking into dts and
Transformable Subscriptions but am not real clear
if that would be better.
any advice would be appreciated.
thanks,
-comb
Would this be a static filter or a dynamic filter, ie where store_id=2
(static) or where store_id=hostname() (dynamic)?
There is more processing involved in using filters. The impact may vary
widely.
Hilary Cotter
Looking for a SQL Server replication book?
Now available for purchase at:
http://www.nwsu.com/0974973602.html
"Combfilter" <adsf@.asdf.com> wrote in message
news:MPG.1c0e66c5405f97bc9896ef@.news.newsreader.co m...
> Hello.
> I need to setup a filter for a really busy db
> that we are replicating. I was wondering what
> type of filter to use. I am afraid that the
> where clause of a row filter will create a major
> performance hit. I was looking into dts and
> Transformable Subscriptions but am not real clear
> if that would be better.
> any advice would be appreciated.
> thanks,
> -comb
|||In article <OmLTYxk0EHA.1932
@.TK2MSFTNGP09.phx.gbl>, hilary.cotter@.gmail.com
says...
> Would this be a static filter or a dynamic filter, ie where store_id=2
> (static) or where store_id=hostname() (dynamic)?
> There is more processing involved in using filters. The impact may vary
> widely.
>
it's static. where fkstoreid in (5001,5002)
like that.
-comb
|||is fkstoreid indexed?
Hilary Cotter
Looking for a SQL Server replication book?
Now available for purchase at:
http://www.nwsu.com/0974973602.html
"Combfilter" <adsf@.asdf.com> wrote in message
news:MPG.1c0e87f9669ff2889896f0@.news.newsreader.co m...
> In article <OmLTYxk0EHA.1932
> @.TK2MSFTNGP09.phx.gbl>, hilary.cotter@.gmail.com
> says...
> it's static. where fkstoreid in (5001,5002)
> like that.
> -comb
|||In article <#qRjNSl0EHA.3072
@.TK2MSFTNGP11.phx.gbl>, hilary.cotter@.gmail.com
says...
> is fkstoreid indexed?
>
yes
|||This filter probably is optimal.
You might want to look at replicating the execution of stored procedures -
this can lead to radical performance increases.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"Combfilter" <adsf@.asdf.com> wrote in message
news:MPG.1c0ea5cf51e7c2e59896f1@.news.newsreader.co m...
> In article <#qRjNSl0EHA.3072
> @.TK2MSFTNGP11.phx.gbl>, hilary.cotter@.gmail.com
> says...
> yes
|||In article <OP2$6Gv0EHA.3368
@.TK2MSFTNGP10.phx.gbl>, hilary.cotter@.gmail.com
says...
> This filter probably is optimal.
> You might want to look at replicating the execution of stored procedures -
> this can lead to radical performance increases.
>
thanks,
-comb