Merge Replication && Update On Keys

Feb 21, 2006

Hi, I'am using several SQL 2000 servers with different working merge-replications. Actually I wrote a .NET assembly which makes updates to key values in one of the replicated tables:

Ex:
update ReplTable set key = -key where key between (1 and 100)

Loop
......
update ReplTable set key = NewKey where key = ....
end of loop

Intention is to resort the datarows. So I made two updates to every keyvalue in a very short time. At the ConflictViewer I got messages like:

"The row was inserted at 'ServerX' but could not be inserted at 'ServerY'. Violation of PRIMARY KEY constraint 'PK_xxxx. Cannot insert duplicate key in object 'ReplTable'. "

The replication did only deliver one (the last) update - this makes the violation. Is there a possibility to make the mergeagent known that I wanted to deliver every transaction? Is there a parameter in the agents profile?



View 1 Replies


ADVERTISEMENT

Merge Replication - Foreign Keys

Jul 9, 2004

I am currently new to Merge Replication and have not been able to find one really simple underlying answer to the fundamentals of Merge Replciation....

Foreign Keys.... An example - I have two DBs in separate locations both adding new records. Assume that adding these new records create foreign key links to other tables. Of course when you come to synchronise - a foreign key in a table perhaps now relates to a different record.. How do you deal with this?

Eg: two DBs, the DBs both started out the same with 10 records in the CARS table for example. The two dbs also had 20 records in the MODEL table which states the model name and a foreign key relationship to the cars table. As the two DBs get updated separately and the result is now one DB has 2 new records in the car table for example and the other has 3 new records in its cars table... Of course these have corresponding entries in their MODEL table referencing primary keys. So how do I, using merge replication keep all these new records and update their foreign key references to suit as they synchronise?

It seems fundamental to merge replication and I cannot find advice anywhere on how to do this. Do I have to change both tables to use GUIDs as primary keys rather that incrementing numbers perhaps??

advice would be greatly appreciated

View 8 Replies View Related

Merge Replication And Foreign Keys

Apr 10, 2007

i'm struggling with merge replication and foreign key constraints.

i have four tables:

- owners(id, name, firstname, address, phone)
- cars(id, licenceplate, ownerid) (thus with ownerid FK to the owners table)
- busses(id, licenceplate, ownerid) (thus with ownerid FK to the owners table)
- ships(id, licenceplate, ownerid) (thus with ownerid FK to the owners table)

now, i want to merge only the OWNERS table (article) between my 5 client pc's and 1 server.

I don't manage to reach this.
Using the merge replication upon all 4 tables works, but replicating only the owners table seems to be impossible.

Is it really impossible to replicate only the owners table, or do I forget something?

these are my create table scrips:
create table Owners (
id int identity,
name varchar(20),
firstname varchar(20),
address varchar(20),
phone varchar(20),
CONSTRAINT PK_owners
PRIMARY KEY(id)
);

create table cars (
id int identity,
licenceplate varchar(20),
ownerid int,
CONSTRAINT PK_cars
PRIMARY KEY(id),
CONSTRAINT FK_cars_ownerid
FOREIGN KEY(ownerid) REFERENCES owners(id) ON DELETE CASCADE
);

create table busses (
id int identity,
licenceplate varchar(20),
ownerid int,
CONSTRAINT PK_busses
PRIMARY KEY(id),
CONSTRAINT FK_busses_ownerid
FOREIGN KEY(ownerid) REFERENCES owners(id) ON DELETE CASCADE
);

create table ships (
id int identity,
licenceplate varchar(20),
ownerid int,
CONSTRAINT PK_ships
PRIMARY KEY(id),
CONSTRAINT FK_ships_ownerid
FOREIGN KEY(ownerid) REFERENCES owners(id) ON DELETE CASCADE
);

View 2 Replies View Related

Update Query Is Slow With Merge Replication?

Dec 4, 2014

I have a database with enabling merge replication.

Then the problem is update query is taking more time.

But when I disable the merge triggers then it'll update quickly.

View 3 Replies View Related

SQL 2012 :: Update Query Is Slow With Merge Replication?

Dec 3, 2014

I have a database with enabling merge replication.

Then the problem is update query is taking more time.But when I disable the merge triggers then it'll update quickly.

View 1 Replies View Related

How To Create Merge Replication With Latest Update Always From Subscribers

May 13, 2006

Hi ,

I am trying to create Replication Topology (Merge Replication) like below.

Subscriber1 --> Publisher <-- Subscriber2.

I have created both subscribers with Subscription Type as Server with Priority as 75. I am updating the Column A of Row_10 in Subscriber1 on time say 11 am. After i am running the Starting synchronizing agent from Subscriber1. The value propagated to Publisher now publisher contains the latest value in Column A. Uptonow the Subscriber2 is not synchronized with Publisher.

Now in Subscriber2 also Column A of Row_10 is updated say at 11.10 am. Actually now Publisher contains the value from Subscriber1 for that Column and in Subscriber2 we have the same column updated.

Now i am running the Synchronization in Subscriber2, i am getting the result which is not expected. Here Publisher's value is propagated to Subscriber2. But as per real scenario Subscriber2 has the Latest value which is updated on 11.10 AM.

I don't know what am i missing here. Actually merge replication should see the time stamp and it has to decide winner. But here it always considers publisher as a winner and puts the data to Subscriber.

Can anyone help ?

Thanks in advance

View 4 Replies View Related

Merge Replication – Bug In Business Logic Update Handler

Nov 17, 2006

I have got a business logic update conflict handler working, but I have had to work round what appears to be a bug.

Please can someone confirm if this is indeed a bug €“ and if it is a known bug?

My conflict handler needs to take some columns from the publisher row and some from the subscriber row in the event of conflict.

I can quite happily generate a custom dataset which contains the winning row that I want €“ I can see that because I can step through the conflict handler with debug when a conflict occurs.

However, just returning ActionOnUpdateConflict.AcceptCustomConflictData from the UpdateConflictsHandler method does not set the publisher and subscriber columns correctly. I end up with different values on the two databases.

I have found that the only way to get the correct rows on both publisher and subscriber is to create a new ADO connection to the publisher and actually perform an update €“ updating all the modified columns. This now works reliably in my testing.

Fortunately, due to business rules the frequency of update conflicts are likely to be very infrequent, but I would very much like to avoid having to do the €˜unnecessary€™ update.

Notes:

I am using column level tracking €“ but I have seen the problem with row level tracking too
I have mainly been using SP1 but have repeated the test on a configuration using the SP2 CTP €“ and the problem occurs there too
The problem is not due to complex logic in my code. If the method just sets customDataSet = publisherDataSet.Copy and then returns ActionOnUpdateConflict.AcceptCustomConflictData, the changed and winning publisher values are not sent to the subscriber

Any thoughts would be much appreciated

View 5 Replies View Related

Does The Actual Update Statement Of A Table Affect Merge Replication?

Dec 8, 2006

Suppose your using Merge Replication.

2 Users in 2 locations issue updates to the same table. 1 updating 1 column and the other updating another column. Now in reality the actual Stored Procedure issuing the update statement is passed in all the possible columns that could change and builds an update statement that updates all columns even the ones that havent changed.

Will this break Merge Replications conflict tracking? Or does SQL Server 2005 Merge Replication pickup that in reality the 2 updates only in reality changed the values in 2 columns.

View 1 Replies View Related

Problem : Extreme Activity - Slow Merge Replication - From A Schema Update

Jul 4, 2007

Hi there,



We have a big problem here with merge replication, specifically whenever a schema change occurs. We are replicating schema changes, and triggers/stored procedures. The example is that we changed about 150 stored procedures and about 30 triggers. This is then replicated to the subscriber database (which is also a merge publisher for further remote systems that were offline at the time) over a 10Mb link - hardly low bandwidth. However, the replication process takes about an hour and a half - considering the SQL on the primary server took less than a minute to run this is a big suprise.



We've run a trace to see if we can identitfy what is going on. There seems to be a great number of calls to sp_MSunmarkschemaobject - we are still waiting for a trace to complete to fully analyse this however it looks like it calls this repeatedly for every stored procedure in the database. We are currently re-testing to one of the remote servers with the merge agent set to the slow profile (not much hope that this will alter the poor performance).



This task looks to be excessive - and certainly does not seem to function in a sensible manner. Has anyone else had similar issues or have any suggestions. This is very infuriating as it means that the servers are effectively offline for a minimum of and hour and a half (in fact the remoter servers take over 4 hours !).



Thanks.

View 2 Replies View Related

Replication :: Difference Between Snapshot And Transaction And Merge Replication?

May 26, 2015

What is the main difference between snapshot and transactional and merge replication?

View 5 Replies View Related

Replication - Primary Keys

May 17, 2001

Hi,
Just a continuation to my earlier queries on replication.
I have a db which I want to replicate - it do not have pk?
I do not want to create pk on existing columns - so I thought of creating one more column in all the tables and make them pk .
Any one has any idea if this will work fine or may give any problem which I should be prepare for.
Any thought appreciated -
pvd

View 1 Replies View Related

How Do We Add A New Column To A Merge Replication Article, But Specify It As Not For Replication?

Aug 30, 2007

Hi all,

I know that adding a column using ALTER TABLE to add a column automatically allows SQLSERVER 2005 to replicate the schema changes to the subscribers, however, I would like to add a new column to an existing article that is being used for merge replication, however, I don't want this column to be replicated. Re-initialising the subscriptions is not a option. Help would be appreciated.

I am using SQLSERVER 2005 (SP1).

View 3 Replies View Related

Transactional Replication And Foreign Keys

Feb 7, 2007

When I use Management Studio (SQL Server 2005 SP 1) to set up transactional replication with updateable subscriptions, the snapshot initialization doesn't push the foreign key constraints. If I add a foreing key at the publisher, the change doesn't make it to the subscriber, even though the Publication Properties' Subscription Options panel shows Replicate Schema Changes set True - what am I missing?

Thanks, Liston

View 1 Replies View Related

Seperate Date And Time Merge; Done At SQL Update Or C# .NET Then Update

Feb 18, 2006

I do realize that his could be posted in a few spots but I think the answer is in the SQL.
I have a ASP.NET page, with a SqlDataSource, Text Box and Calendar Controls. I have the textbox and calendar controls eval'ed to the same sql data source DateTime Field. The text box is formatted eval to small time and the calendars eval has no formatting.
ex:
<asp:TextBox ID="START_TIME" Text='<%# Eval("EVENT_START","{0:t}") %>' runat=server Width=200></asp:TextBox>
I want to merge the two controls; one has the date the other has the time when I update the pages data to the SqlDataSource field EVENT_START. I've tried a couple of methods, but I would like some other opinions. As Sql server only supports date and time together I am storing the two together.
I could merge the two together in the code behind on the update button's event handler or merge the two during the update query using parameters.
Not that I could get an illegal date for the calendar control, but I could get garbage from the textfield time. So I still would have to do validation on the text field before the SQL server could do the update.
There's a few ways to go about this, so I was wondering if anyone else has figured out an elegant way to handle it.
wbochar

View 1 Replies View Related

How To Publish Tables Without Primary Keys In Transactional Replication

May 16, 2007

Hi All

I am a newbie to replication. I just want to know Is there any way to publish tables (articles) without primary keys in transactional replication.



Early Thanks,

Salman Shehbaz.

View 1 Replies View Related

Update Table, Foreign Keys Etc

Aug 16, 2004

I have two tables as below. I want to update a quote and change the item for which it is for. So I want to do an update statement to change the cat_ref that the quote is for. However, when I do this I get a foreign key conflict with cat_ref in the item table. How do I get around this? Thanks


Code:

CREATE TABLE Item (
cat_ref VARCHAR(5)PRIMARY KEY,
descrip VARCHAR(50),
date_added SMALLDATETIME,
cat_type VARCHAR(20))


CREATE TABLE has_quote (
quote_id INT IDENTITY (1,1) PRIMARY KEY,
date_last_pricecheck SMALLDATETIME,
cat_ref VARCHAR(5)FOREIGN KEY
REFERENCES Item(cat_ref)
ON DELETE CASCADE,
first_name VARCHAR(10),
surname VARCHAR(10),
FOREIGN KEY (first_name, surname)
REFERENCES Customer(first_name, surname)
ON DELETE CASCADE
ON UPDATE CASCADE)

View 5 Replies View Related

Update Foreign Keys Using Triggers

May 18, 2008

Hello,

I would like to update foreign keys using triggers. At least thats what I think is the solution when having multiple references to a table in order to avoid the "cycles or multiple cascade paths" error message.

Anyway, here are three tables
Dentist table
dentist_id int identity (auto increment)

Patient table:
patient_id int identity (auto increment)

Appointment:
apointment_id int identity (auto increment)
id_dentist int FK to dentist_id
id_patient int FK to patient_id

I am gooling but cant find a way to make a trigger run only when the dentist_id from dentist table is updated. Also, is there a way to get the new id and old id somehow? I saw some posts with new.dentist_id and old.dentist_id but apparently is not for sql server.

Thank you.

View 2 Replies View Related

Update One Table From Another Using Primary Keys

Apr 17, 2014

I have two tables:

tbl_Vehicles (primary table)
tbl_DealerFeed_temp (temporary table)

I load values from a TXT file into the temporary table. From there, I figure out which records are new and need to be added to the primary table, and which records are duplicates, and need to a) update the primary table and b) be deleted from the temporary table.Basically, I need to write a SQL statement to grab the records that exist in BOTH tables based upon two primary criteria:

d_id in temporary table = d_id in primary table
df_t_v_stock_number in temporary table = v_stock_number in primary table

There are several fields that must be updated if the d_id and v_stock_number match:

v_price
v_internet_price
v_other_price
v_mileage

View 9 Replies View Related

Merge Replication Set Off Transactional Replication

Oct 9, 2007

I am working on bringing our disaster recovery site to be a live site. Currently we replicate to one of out servers (server B) with merge replication (from server A). Server A also does one way transactional replication form some table to several other servers including servers at the DR site.

This setup is not going to be fast enough for what we need so I am wondering if a table is receiving merge replication will the merge updates also replicate down the transaction path??

Example...
Server B update a row and merges to Server A. With this update them replicate (via transactional) to Server C??

thanks...

View 5 Replies View Related

One Way Merge Replication

Feb 14, 2002

Hi everbody,
I setup the Merge Replication , it is working perfectly. But i have one problem now it is updating both ways. I nedd one way. Any body tell me which parameter i have to change.

Thanks in advance

View 1 Replies View Related

Merge Replication

Aug 12, 2002

Hi,

My production box is running on NT4.0,SP6, SQL Server7.0,SP2. We implemented Merge replication. Working fine last 7 months. Last weekend i disabled replication, Successfully removed Distributor and Publishor. After that try add new fileds but won't allowed me. It's give the error message. I Also found Some Conflict_tables found almost 20 tables. All system Tables. Can delete these these tables, if i delete any problem my database.
I added filelds many times but this time i got errors.

Please help me anybody.

View 6 Replies View Related

Merge Replication

Jul 31, 2000

I have just installed replication on our production server to Merge Replicate with a Laptop server that will travel from time to time. I have now noticed that we cannot add or change any fields or attributes on the tables which are being replicated (which are all tables in the DB). This is a problem because we are changing and adding columns all of the time. Is there a way around this issue like shutting down the replication service or something? I have been unsuccessful in finding a way around this other than removing replication while we make changes.

Thank you in advance for any help!

View 1 Replies View Related

Merge Replication

Jan 22, 2001

I have implemented a Merger replication on our development server and I get a fillowing error when I try to update one of the table in publisher.
"Transaction cannot start while in firehose mode"

What does this mean.

Thank You,
John

View 1 Replies View Related

Merge Replication

Dec 19, 2000

Hi,
I read some where that replication has two types conflict resolution, 1. row based and 2. Column based...
If I am right...
Can any one point me how to find out this option and how to set it up....

Thanks,

Mohammed.

View 1 Replies View Related

Merge Replication

Sep 16, 1999

Hi all,

I have a merge replication going between 4 servers. The problem is when ever I do some BCP transfer to one of the tables in one of the servers. It puts the data in that table. But that Data does not get replicated to any other server like it should.

Please Advice on what to do. Is there any option I am forgetting to set or something.

Thank you for all your time in advance.
Aziz

View 3 Replies View Related

Merge Replication

Sep 12, 2003

I have successfully tried merge replication on single server with 2 databases.
now i want to do the same with different servers,
when i create pull subcription on server 2 which user account should I use?
it is giving log in failure
i tried using windows admin account and also the 'sa' account.

please help me out
thanks

View 1 Replies View Related

Merge Replication (Again)

Feb 23, 2004

Hi All,

I have posted this earlier and I am re-posting it simplifying what I had said.

The scenario is:

I have two sql server database instances with the same database schema and all. However, both of them have different data. I have not set them for replication at all. Now, I want to do merge replication between them such that the data between them could be syncronized.

When I do pull merge subscription I have two choices -
1.Bringing schema and data to subscriber from publisher

2.Not bringing the schema and data from publisher to subscriber.

Obviously, I chose the second choice. But upon syncronizing I dont see any data from publisher coming to subscriber and vice-versa. If I add new data to publisher and do syncronization, I can see ONLY the new data created after the replication setup in subscriber. If I add new data to subscriber and do syncronization then the new data is removed from subscriber and not propagated to publisher.

Is there any way I can make this work??

Niben

View 10 Replies View Related

Merge Replication

Jan 2, 2007

Hi,

I have just set up Merge replication, I have two servers, server A and server B, the merge replication worked successfully but I don't quite sure which databases should or should not replicated? If not, what other methods should I use?

I would really appreciated any comments or advice out there!

-whitebelt

View 14 Replies View Related

Merge Replication

Mar 21, 2002

I had set up merge replication. I got these error messages where replications starts "Column names in each table must be unique. Column name 'PubID' in table 'bonflict_DBName_PHP_Data_Publications' is specified more than once "

PHP_Data_Publications table defind as:

CREATE TABLE [dbo].[PHP_Data_Publications] (
[PHP_Pub_ID] [uniqueidentifier] NOT NULL ,
[PHP_Data_ID] [uniqueidentifier] NOT NULL ,
[PubID] [uniqueidentifier] NOT NULL ,
[UserID] [uniqueidentifier] NOT NULL ,
[Username] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Publication] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Pub_Year] [datetime] NULL ,
[Pub_Name] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[PHP_Data_Publications] WITH NOCHECK ADD
CONSTRAINT [DF__PHP_Data___rowgu__01E91FA0] DEFAULT (newid()) FOR [rowguid]
GO

CREATE UNIQUE INDEX [index_1466488303] ON [dbo].[PHP_Data_Publications]([rowguid]) ON [PRIMARY]
GO


Thanks,

Chanthol

View 3 Replies View Related

Merge Replication ???

Oct 11, 2001

Hi

Is it possible to modify or add new fields in sql 2000 when the instance
became publisher ? I tried it several times but it failed. I access microsoft website but i did not help.

Thanks
Pheckz

View 3 Replies View Related

One Way Merge Replication

Oct 12, 2001

Hi everbody,

Anybody tell me about implementation of oneway merge replication.
Thanks

View 2 Replies View Related

One Way Merge Replication

Feb 5, 2001

Hi everyone

SQL Server BOL says merge replication can be done in only one direction. But my understanding is Merge replication happens in both ways between publisher and subscriber.

How can i allow data movement from only wince sql ce subscribers and not from publisher running sql 2000 and win 2k.

Please reply immediately bcoz i require a solution which has to be implemented very soon.

Thanks in advance

Satheesh

View 1 Replies View Related

Merge Replication

Jun 29, 2004

hi,
in merge replication,i make a request subscriber with a priority 25.00,when i update the same date,it always choose the update from the publishing server,why????how does it work???
thx inadvance

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved