Showing posts with label reproduced. Show all posts
Showing posts with label reproduced. Show all posts

Thursday, March 8, 2012

Bug in MS Management Studio for SQL-Server 2005 while creating a publication!

Hello,

I found a bug in Management Studio, which can be reproduced with following steps:

1. Create a new publication with the 'New Publication Wizard'
2. Select a database which contains at least 2 tables.
3. Select 'transactional publicatioon'
4. Select at least 2 tables as articles
5. Set article properties for all table articles
6. Change 'Statement Delivery' to 'Insert statement', 'Update statement' and 'Delete statement' and save the article properties.
7. If you now check the properties for a single article you find that the 'Statement Delivery' is set to 'Do not replicate...'. If you generate this publication and create a subscritpion you will see, that actual no replication take place.

It took me a while to find out why my replication doesn't work! :-((

Wolfgang Kunk

PS : Management Studio version is 9.00.1399.00

Unfortunately that part of the wizard is kind of broke, and it won't get fixed for SP2 either. A similar issue was raised in an earlier post as well - http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=984751&SiteID=1.

The workaround is to either use TSQL scripts to set everything up, or set everything up with UI and then immediately issue a sp_changearticle to set it.

As a side note, may I ask why you want to use "Insert/Update/Delete statement" instead of the default stored proc? This can have bad performance impact against a SQL subscriber.

|||Normally we use T-SQL scripts to set up replication. So it is not a real big problem.
I wanted to see if it is a known bug!

Can you please explain what the bad performance impact can be?
As far as I know the default stored procs execute nothing else then a simple insert, update or delete statement. So I cannot see a bad impact. The only thing is that the optimizer optimzes a stored proc once while it has to optimize insert, update ans delete-statements every time.

Wolfgang Kunk|||

When using stored procs, each proc is fired off as an individual RPC, and the proc itself generates a plan that can be reused over and over for optimal performance.

When using SQL, we fit as many commands as we can (I think up to 500) into a single parameterized sp_executesql and execute it all at once. Meaning one single sp_executesql call can have anywhere from one to 500 different ins/upd/del statements - this generates one single plan. The next sp_executesql call will most likely be different, and generate a totally different plan. So what happens is every call will most likely have to be compiled because you'll never get plan reuse. In an OLTP scenario where you're replicating thousands of commands a second, you'lll definitely see an impact in performance.

For proof, apply a mixed/random workload to the publisher and then trace the distribution agent calls at the subscriber using SQL and stored procs, you'll see what I mean.

SQL is used mostly with heterogeneous subscriber cases and the very rare case when customer has a purpose for SQL subscriber cases.

|||Thanks for the explanation.

At the moment we only use heterogenous subscriber, where we work with SQL. So I used SQL for my first MS-MS Replication as well. I will take your recommendation in account for my further tests!

Wolfgang Kunk

Sunday, February 19, 2012

Broken merge. Need help.

Hi,
Seems I found how to brake merge replication.
Actually I reproduced this situation on my test env. after we found it on
production.
OK we have SQL2K EE SP3a on W2k AE SP4.
Suppose You create a table with few fields of different type
(field1,field2,field3.etc.. rowguid)
Then you publish it for merge replication an push the subscription to
subscriber (with initialization).
Everything works fine.
Then suppose you need to ALTER one of columns (let's say field2) in that
table (char(12 ->char(20))
In merge (or whatever) you have to do sp_repldropcolumn then
sp_repladdcolumn and restore data of that column on publisher.
All changes are done and synchronized with the subscriber. Everything still
works.
Then you create a new merge publication including the same table and push it
to another subscriber (with initialization).
After we found that changes are not correctly transferred between two
subscribers. All data is still correct at the publisher but at the
subscribers some fields are different.
Does anyone know about this? Or any suggestions how to resolve this problem?
Thank You
Darius T.
Hi Darius,
Try looking at the .sch file created by the publication. It is usually
located at: ...\MSSQL\REPLDATA\name_of_publication. I have dealt with cases
that the snapshot file for the creation of the table was not correctly
created. You can manually modify this file to create the correct table with
the correct columns. When the initialization takes place, it will take this
file and apply it tio the subscribers. Hope this helps!
-Jose Molina
"Darius T." <dta@.takas.lt> wrote in message
news:%23s$CB3Z$EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Hi,
> Seems I found how to brake merge replication.
> Actually I reproduced this situation on my test env. after we found it on
> production.
> OK we have SQL2K EE SP3a on W2k AE SP4.
> Suppose You create a table with few fields of different type
> (field1,field2,field3.etc.. rowguid)
> Then you publish it for merge replication an push the subscription to
> subscriber (with initialization).
> Everything works fine.
> Then suppose you need to ALTER one of columns (let's say field2) in that
> table (char(12 ->char(20))
> In merge (or whatever) you have to do sp_repldropcolumn then
> sp_repladdcolumn and restore data of that column on publisher.
> All changes are done and synchronized with the subscriber. Everything
> still works.
> Then you create a new merge publication including the same table and push
> it to another subscriber (with initialization).
> After we found that changes are not correctly transferred between two
> subscribers. All data is still correct at the publisher but at the
> subscribers some fields are different.
> Does anyone know about this? Or any suggestions how to resolve this
> problem?
> Thank You
> Darius T.
>
>
|||> After we found that changes are not correctly transferred between two
> subscribers. All data is still correct at the publisher but at the
> subscribers some fields are different.
Could you be more specific about this situation ?
What do you mean with "some fields are different." ?
Are you making inserts/updates only on publisher ?
Is replication working properly (replicating data to both subscribers) if
you skip step 2 (alter of the column) ?
Regards,
Kestutis Adomavicius
Consultant
UAB "Baltic Software Solutions"
"Darius T." <dta@.takas.lt> wrote in message
news:%23s$CB3Z$EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Hi,
> Seems I found how to brake merge replication.
> Actually I reproduced this situation on my test env. after we found it on
> production.
> OK we have SQL2K EE SP3a on W2k AE SP4.
> Suppose You create a table with few fields of different type
> (field1,field2,field3.etc.. rowguid)
> Then you publish it for merge replication an push the subscription to
> subscriber (with initialization).
> Everything works fine.
> Then suppose you need to ALTER one of columns (let's say field2) in that
> table (char(12 ->char(20))
> In merge (or whatever) you have to do sp_repldropcolumn then
> sp_repladdcolumn and restore data of that column on publisher.
> All changes are done and synchronized with the subscriber. Everything
still
> works.
> Then you create a new merge publication including the same table and push
it
> to another subscriber (with initialization).
> After we found that changes are not correctly transferred between two
> subscribers. All data is still correct at the publisher but at the
> subscribers some fields are different.
> Does anyone know about this? Or any suggestions how to resolve this
problem?
> Thank You
> Darius T.
>
>
|||"Some field are differnet" means that if you make update on a record at
publisher and run merge agents to both subscribers You find that all data is
correct only at subscriber 2, but at subscriber 1 data in some fiels in not
updated correctly. (INSERT,DELETE statements work properly).
The same things happening when you make an update on subscriber 2. Data is
merged correctly with publisher but not with subscriber 1.
I could post a step by step script here to see how it happens (if you are
interested)
Darius
P.S. gal galime susirayti ir lietuvikai jei k.
"Kestutis Adomavicius" <kicker.lt@.nospaamm_tut.by> wrote in message
news:%232dPB%23s$EHA.2444@.TK2MSFTNGP10.phx.gbl...
> Could you be more specific about this situation ?
> What do you mean with "some fields are different." ?
> Are you making inserts/updates only on publisher ?
> Is replication working properly (replicating data to both subscribers) if
> you skip step 2 (alter of the column) ?
> --
> Regards,
> Kestutis Adomavicius
> Consultant
> UAB "Baltic Software Solutions"
>
> "Darius T." <dta@.takas.lt> wrote in message
> news:%23s$CB3Z$EHA.1452@.TK2MSFTNGP11.phx.gbl...
> still
> it
> problem?
>
|||Thanks, Jose,
I've checked those .sch scripts. Didn't find any problem.
Darius
"Jose Molina" <rcmaniac23@.yahoo.com> wrote in message
news:OCHeF8k$EHA.3840@.tk2msftngp13.phx.gbl...
> Hi Darius,
> Try looking at the .sch file created by the publication. It is usually
> located at: ...\MSSQL\REPLDATA\name_of_publication. I have dealt with
> cases that the snapshot file for the creation of the table was not
> correctly created. You can manually modify this file to create the
> correct table with the correct columns. When the initialization takes
> place, it will take this file and apply it tio the subscribers. Hope this
> helps!
> -Jose Molina
>
> "Darius T." <dta@.takas.lt> wrote in message
> news:%23s$CB3Z$EHA.1452@.TK2MSFTNGP11.phx.gbl...
>