Wednesday, March 28, 2012

Question about Replication

Hi
Let's suppose we have the following design (everything on the same server):
Database1 (Publisher)
Database2 (Publisher)
Database1 and Database2 have the same structure.
Now I create 2 subscribers on a database called 'DatabaseDest'
Subscriber 1-> Source: Database1, Destination: DatabaseDest
Subscriber 2-> Source: Database2, Destination: DatabaseDest
I want DatabaseDest to have data from Database1 and Database2.
Is this possible?
I'm having problems if for example, I'm transferring a record from
Database1 which has the same Primary Key of another record on Database2.
What do you guys suggest for this kind of architecture?
ThanksIf they are on the same server, how about using stored procedures or
triggers to keep the databases synchronized.
If you must use replication, read the BOL very carefully. It has examples
of how to handle PK issues and so forth.
Rick Sawtell
MCT, MCSD, MCDBA|||Rick Sawtell wrote:
> If they are on the same server, how about using stored procedures or
> triggers to keep the databases synchronized.
> If you must use replication, read the BOL very carefully. It has examples
> of how to handle PK issues and so forth.
>
> Rick Sawtell
> MCT, MCSD, MCDBA
>
>
Right now is on the same server because I'm just testing. However, in
the real world will be different servers.
I thought that Replication would take case of PK issues automatically.
Isn't that true?|||> Right now is on the same server because I'm just testing. However, in
> the real world will be different servers.
> I thought that Replication would take case of PK issues automatically.
> Isn't that true?
>
That depends. Take a look at the NOT FOR REPLICATION option and so forth.
What type of replication are you looking to do? Merge, Transactional...
Are your subscribers going to be updating back to the publishers? Etc.
Rick Sawtell|||> That depends. Take a look at the NOT FOR REPLICATION option and so forth.
> What type of replication are you looking to do? Merge, Transactional...
> Are your subscribers going to be updating back to the publishers? Etc.
> Rick Sawtell
Ok, I'll take a look right now. I have been testing the 3 methods, but I
have noticed that at least for Snapshot and Merge, SQL server is always
overwriting everything, so I cannot have data from Publisher1 and
Publisher2 at the same time, if I have data with the same PK.
My destination database will be read-only, so the traffic will be always
one way, from the Publishers to the Subscriber. Which type of
replication do you think is the best in my case?
Thanks for your help.|||>
> My destination database will be read-only, so the traffic will be always
> one way, from the Publishers to the Subscriber. Which type of
> replication do you think is the best in my case?
>
Transactional would be best for that scenario.
Rick Sawtell
MCT, MCSD, MCDBA

No comments:

Post a Comment