Showing posts with label replication. Show all posts
Showing posts with label replication. Show all posts

Tuesday, March 27, 2012

Customized Merge Replication Snapshot

I'm currently using merge replication that is not syncing the data when
applying the snapshot.
When applying the snapshot, the only bcp files transfered are
msmerge_contents.bcp, msmerge_genhistory.bcp, sysmergesubsetfilters.bcp
and msmerge_tombstone.bcp.
The problem is that the snapshot agent generates bcp files for all of
my tables. I will never use these and delete them as soon as they are
generated.
Does any know if it's possible to have the snapshot agent only copy the
merge tables and not the user tables but still generate the other
metadata scripts?
Thank you,
seanbell68@.gmail.com
I'm confused by what you are doing and why. For a no-sync subscription these
files must be generated and applied on the subscriber. Failure to do this or
emptying some of these file will guarantee your merge replication solution
will not work.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
<seanbell68@.gmail.com> wrote in message
news:1121205750.708059.309200@.g44g2000cwa.googlegr oups.com...
> I'm currently using merge replication that is not syncing the data when
> applying the snapshot.
> When applying the snapshot, the only bcp files transfered are
> msmerge_contents.bcp, msmerge_genhistory.bcp, sysmergesubsetfilters.bcp
> and msmerge_tombstone.bcp.
> The problem is that the snapshot agent generates bcp files for all of
> my tables. I will never use these and delete them as soon as they are
> generated.
> Does any know if it's possible to have the snapshot agent only copy the
> merge tables and not the user tables but still generate the other
> metadata scripts?
> Thank you,
> seanbell68@.gmail.com
>
|||There are times, such as after using sp_mergecleanupmetadata, when
snapshots are required to be regenerated. I also use a copy of the
publication database when creating new subscribers so the data is
already synced in that case as well. In fact, I have never used the
bcps generated for the user tables.

Thursday, March 22, 2012

Custom Stored Procs: Determining source table name

Hello all ...

I'm looking at writing some customized insert, update and delete stored procs for a replication target. For various reasons I would like to write a "one size fits all" custom stored proc for each of these tasks.

It looks like I can get the data values passed as parameters just fine.

I was wondering if there's a way to also pass the source schema and table name as parameters, or to determine these on the fly in my all purpose stored procs. Some replication products refer to these types of values as "tokens" that can be included in the replication data stream sent to the target.

I can adjust the source database replication publications, and article definitions, but I cannot modify the actual source database tables to include these as values in data columns. It is possible a view that contains these elements as strings might fly, but I was hoping to avoid cluttering the source database.

A handy trick or technique would be helpful!

Thanks!

DB

To answer your question, no the distribution agent does not and cannot pass the table name as a parameter. Since the custom procs are per article, it is expected the table name to be included in the proc.|||

OK, I'll work with that.

Thanks very much!

DB

Monday, March 19, 2012

Custom Resolver for merge replication

Hi there!
I'm trying to create a custom resolver for merge replication exactly like in the MS example.
It seems to work, but only ONE time. If I change, insert or delete a record in a table the second time, the subscriber monitor comes with the following errors:

Error messages:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147199411)
The Merge Agent encountered an error when executing code in the 'UpdateHandler' method implemented in the business logic handler 'D:\Program Files\Microsoft SQL Server\90\COM\MyResolver.dll'. Ensure that the overridden 'UpdateHandler' method has been properly implemented in the business logic handler. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147199411)
This last error is of course dependant on my action (update, delete, insert).
My code is -exactly- like the example (I just stripped out the log message).
Does anyone know why I am "trying to read or write protected memory" ?
The thing is that I'm trying to create an application that detects if a table changes. Is this the right way to do this anyway or are there better solutions?
Any help is appreciated! Thanks!

Hi there!

Any resolution to the problem described in the post? I'm getting the same problem with custom resolver.

Custom Resolver for merge replication

Hi there!

I'm trying to create a custom resolver for merge replication exactly like in the MS example.

It seems to work, but only ONE time. If I change, insert or delete a

record in a table the second time, the subscriber monitor comes with

the following errors:

Error messages:

Attempted to read or write protected memory. This is often an

indication that other memory is corrupt. (Source: MSSQL_REPL, Error

number: MSSQL_REPL-2147199411)

The Merge Agent encountered an error when executing code in the

'UpdateHandler' method implemented in the business logic handler

'D:\Program Files\Microsoft SQL Server\90\COM\MyResolver.dll'. Ensure

that the overridden 'UpdateHandler' method has been properly

implemented in the business logic handler. (Source: MSSQL_REPL,

Error number: MSSQL_REPL-2147199411)

This last error is of course dependant on my action (update, delete, insert).

My code is -exactly- like the example (I just stripped out the log message).

Does anyone know why I am "trying to read or write protected memory" ?

The thing is that I'm trying to create an application that detects if a

table changes. Is this the right way to do this anyway or are there

better solutions?

Any help is appreciated! Thanks!

Hi there!

Any resolution to the problem described in the post? I'm getting the same problem with custom resolver.

Sunday, March 11, 2012

Custom procs for replication

SQL Server 2000 Enterprise

Hello,

I have a test publication of two tables. Both tables are supposed to use a custom update stored procedure
(you know, "Replace UPDATE commands with this stored procedure call:")
When updating Table1 the system calls my custom stored stored procedure.

Here is a small excerpt captured by the Profiler when updating Table1:

exec usp_FNLC_MSupd_Table1 'Jun 24 2005 12:00:00:000AM', NULL, 100081142, 0x01

Looks good. I see that my custom update proc was used (usp_FNLC_MSupd_Table1).

Now, when updating Table2 (Table2 is pretty identical to Table1) Profiler sends this back and the update on the subscriber fails:

exec sp_executesql N'delete from "Table2" where "Dates3ID" = @.P1 insert into "Table2" values (@.P2, @.P3) ', N'@.P1 int,@.P2 int,@.P3 datetime', 8, 8, 'Mar 24 2006 12:00:00:000AM'

Then..

exec sp_executesql N'insert into "Table1" values (@.P1, @.P2) ', N'@.P1 int,@.P2 datetime', 8, 'Mar 24 2006 12:00:00:000AM'
Go

This is what the distribution agent throws back:

Insert Error: Column name or number of supplied values does not match table definition.
(Source: DFBPBSO (Data source); Error number: 213)

So, why isn't the article Table2 using my custom update proc? All I do is updates, no deletes or inserts. No matter what I do for this article, it will not use the custom update proc.

I need help, please. Thank you in advance,
L

When you update a column that's part of a unique constraint, it will be replicated as delete/insert. I'm guessing you're updating a PK column on Table2?

You can find more info on deferred udates here:

http://support.microsoft.com/default.aspx?scid=kb;en-us;238254

|||Yes, thanks, that is what is was. I fixed it. Its working now.

Custom Procedure Replication Error with Oracle Subscriber

The custom procedure was created successfully on Oracle.
The following is the error message that is recieved. What is really odd is
why SQL Server is sending a select of a stored procedure name? Any ideas
as to what is going on here?
SQL> select * from sp_upd_crms_repl where 0 = 1;
select * from sp_upd_crms_repl where 0 = 1
*
ERROR at line 1:
ORA-04044: procedure, function, package, or type is not allowed here
Oracle publishers only replicate tables. It looks like here Oracle is
treating the stored procedure as a table, and is trying to return all the
data as opposed to only the columns (where 1=1).
Oracle publications do add the following objects on the Oracle server:
http://msdn2.microsoft.com/en-us/library/ms152557.aspx
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Michael Meyer" <michael_meyer@.csgsystems.com> wrote in message
news:uoQ%232bjwHHA.4800@.TK2MSFTNGP05.phx.gbl...
> The custom procedure was created successfully on Oracle.
> The following is the error message that is recieved. What is really odd
> is why SQL Server is sending a select of a stored procedure name? Any
> ideas as to what is going on here?
> SQL> select * from sp_upd_crms_repl where 0 = 1;
> select * from sp_upd_crms_repl where 0 = 1
> *
> ERROR at line 1:
> ORA-04044: procedure, function, package, or type is not allowed here
>
>
|||The Oracle side is actually the subscriber. It does appear that it is
treating this as a table instead of a stored procedure. I can't see
anything wrong with the article. The article has the insert and update
commands defined as CALL stored procedures and the actual command names are
the correct stored procedure names.
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:uIyD82kwHHA.600@.TK2MSFTNGP05.phx.gbl...
> Oracle publishers only replicate tables. It looks like here Oracle is
> treating the stored procedure as a table, and is trying to return all the
> data as opposed to only the columns (where 1=1).
> Oracle publications do add the following objects on the Oracle server:
> http://msdn2.microsoft.com/en-us/library/ms152557.aspx
>
> --
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
> "Michael Meyer" <michael_meyer@.csgsystems.com> wrote in message
> news:uoQ%232bjwHHA.4800@.TK2MSFTNGP05.phx.gbl...
>
|||Configure the publication to use SQL Statements instead of the stored
procedures. In the Publication Properties, Articles tab, Select the
properties of the article and Insert, Update and delete deliver formats
select insert statements.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Michael Meyer" <michael_meyer@.csgsystems.com> wrote in message
news:OSxakFlwHHA.484@.TK2MSFTNGP06.phx.gbl...
> The Oracle side is actually the subscriber. It does appear that it is
> treating this as a table instead of a stored procedure. I can't see
> anything wrong with the article. The article has the insert and update
> commands defined as CALL stored procedures and the actual command names
> are the correct stored procedure names.
>
> "Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
> news:uIyD82kwHHA.600@.TK2MSFTNGP05.phx.gbl...
>
|||The reason we were drawn to the custom procedure is that we have long column
names > 30 characters in SQL Server and Oracle can only handle up to 30.
We are trying to handle the mapping in the custom stored procedure in Oracle
since there is no way to do this in SQL Server that we could come up with.
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:O$MTbRmwHHA.4076@.TK2MSFTNGP06.phx.gbl...
> Configure the publication to use SQL Statements instead of the stored
> procedures. In the Publication Properties, Articles tab, Select the
> properties of the article and Insert, Update and delete deliver formats
> select insert statements.
> --
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
> "Michael Meyer" <michael_meyer@.csgsystems.com> wrote in message
> news:OSxakFlwHHA.484@.TK2MSFTNGP06.phx.gbl...
>

Saturday, February 25, 2012

Custom Conflict Resolver

Hi there,

I have created a custom conflict resolver for an article that is using Merge replication. I can register my custom resolver OK, I can change my merge article to use my new custom resolver, but when a conflict occures the replication monitor shows the following errors:

Error messages:

No signature was present in the subject.
(Source: MSSQL_REPL, Error number: MSSQL_REPL-2146762496)
Get help: http://help/MSSQL_REPL-2146762496

The Custom Resolver Component for article 'BRANCH' does not have a valid digital signature. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147198713)
Get help: http://help/MSSQL_REPL-2147198713

At first I thought it was because my assembly wasn't signed, so I signed it. I still get the same error.

I have various debug statements in the assembly and I can see that Initialize and HandleChangeStates gets called ok, but no other overrides.

Can anyone help me please?

Thanks

Graham

Hi Graham

When you added the article with sp_addmergearticle did you want the the signature verified?

[@.verify_resolver_signature = ] verify_resolver_signature

Specifies if a digital signature is verified before using a resolver in merge replication. verify_resolver_signature is int, with a default of 0. 0 specifies that the signature will not be verified. 1 specifies that the signature will be verified to see if it is from a trusted source.

See here for more info:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_repl_11et.asp

Thanks

Nabila Lacey

This posting is provided "AS IS" with no warranties, and confers no rights.

|||Hi there Gravy, i'm new in merge replication, conflict resolution, procedures and more.

I managed to make a replication from a PC to a PPC, and it works, but now i have conflicts updating colums, i never worked with procedures, and i'll have to do one to problaby solve my conflict cause i think i dont need any of the com based resolvers.

Could you explain me how i do a procedure to conflict resolver? if possible the steps, how can i get the publisher table and subscriber table with conflicts, ao can i make some calculations with them and put in the final column to be correct values.

If your could give me some procedure example, or your example, i would be greatfull.
I've read lots of Book online and foruns, and ive not discovered nothing that i need, but i think maybe you could help me.

Thanks in advance

Custom Conflict Resolver

Hi there,

I have created a custom conflict resolver for an article that is using Merge replication. I can register my custom resolver OK, I can change my merge article to use my new custom resolver, but when a conflict occures the replication monitor shows the following errors:

Error messages:

No signature was present in the subject.
(Source: MSSQL_REPL, Error number: MSSQL_REPL-2146762496)
Get help: http://help/MSSQL_REPL-2146762496

The Custom Resolver Component for article 'BRANCH' does not have a valid digital signature. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147198713)
Get help: http://help/MSSQL_REPL-2147198713

At first I thought it was because my assembly wasn't signed, so I signed it. I still get the same error.

I have various debug statements in the assembly and I can see that Initialize and HandleChangeStates gets called ok, but no other overrides.

Can anyone help me please?

Thanks

Graham

Hi Graham

When you added the article with sp_addmergearticle did you want the the signature verified?

[@.verify_resolver_signature = ] verify_resolver_signature

Specifies if a digital signature is verified before using a resolver in merge replication. verify_resolver_signature is int, with a default of 0. 0 specifies that the signature will not be verified. 1 specifies that the signature will be verified to see if it is from a trusted source.

See here for more info:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_repl_11et.asp

Thanks

Nabila Lacey

This posting is provided "AS IS" with no warranties, and confers no rights.

|||Hi there Gravy, i'm new in merge replication, conflict resolution, procedures and more.

I managed to make a replication from a PC to a PPC, and it works, but now i have conflicts updating colums, i never worked with procedures, and i'll have to do one to problaby solve my conflict cause i think i dont need any of the com based resolvers.

Could you explain me how i do a procedure to conflict resolver? if possible the steps, how can i get the publisher table and subscriber table with conflicts, ao can i make some calculations with them and put in the final column to be correct values.

If your could give me some procedure example, or your example, i would be greatfull.
I've read lots of Book online and foruns, and ive not discovered nothing that i need, but i think maybe you could help me.

Thanks in advance

Custom Conflict Resolution Question

Hello,
I have to setup custom conflict resolution so that the
most recent update wins using a column 'lasteditdate' in a
a merge replication scenario and have about 150 tables to
do this on. Do I have to configure each table/article
individually or can I do all necessary tables in one shot?
Any help would be greatly appreciated!
Thanks in advance
Gene,
each one has to be done separately. However, you could create the
publication in SQLDMO then loop round the tables if you want a more
efficient way of doing it.
HTH,
Paul Ibison

Sunday, February 19, 2012

Custom business logic handler question

I am currenly have a simple merge replication topology. The publisher-distibutor is SQL Server 2005 and the subscriber is a SQL Server Express. The type of subscription is non anonymous pull.

I made a custom business logic handler class that is trying the following:

When a new record is inserted in a published table on the pubsliher, some additional records are added in a differenct table in subscriber. Then the "InsertHandler" method returns "AcceptData" in order to allow the agent to add the new record in current table also.

So I am establishing a new connection to the subscriber and I am trying to add the additional recs in the different table. The problem is that this different table is also published as read-only on the subscriber. So my insert fails saying that table is not updatable.

Is there any way to bypass this problem?

In fact I realised in general that when my custom logic handler performs some DML operations on the subscriber, these are NOT considered as part of the replication e.g. the NOT FOR REPLICATION constraints and triggers are active for these operations.

Is this normal?

Do you have these other tables set as download_only articles?

And more importantly why are you trying to insert at the subscriber when you are doing DML at the publisher? Couldn't you do these other DMLs at the publisher and let merge agent insert these new rows at the subscriber?

Custom business logic handler question

I am currenly have a simple merge replication topology. The publisher-distibutor is SQL Server 2005 and the subscriber is a SQL Server Express. The type of subscription is non anonymous pull.

I made a custom business logic handler class that is trying the following:

When a new record is inserted in a published table on the pubsliher, some additional records are added in a differenct table in subscriber. Then the "InsertHandler" method returns "AcceptData" in order to allow the agent to add the new record in current table also.

So I am establishing a new connection to the subscriber and I am trying to add the additional recs in the different table. The problem is that this different table is also published as read-only on the subscriber. So my insert fails saying that table is not updatable.

Is there any way to bypass this problem?

In fact I realised in general that when my custom logic handler performs some DML operations on the subscriber, these are NOT considered as part of the replication e.g. the NOT FOR REPLICATION constraints and triggers are active for these operations.

Is this normal?

Do you have these other tables set as download_only articles?

And more importantly why are you trying to insert at the subscriber when you are doing DML at the publisher? Couldn't you do these other DMLs at the publisher and let merge agent insert these new rows at the subscriber?