Friday, March 30, 2012

Merge Replication.

Hello,
I have two DBs that are the same, the two of them are on two separated networks, update happens in the both of them and i need to keep them both the same, (replicated) how can i copy changes from one to other and other to one ;)
anybody has an idea?
thanks,Refer to SQL server books online for information on Merge Replication which is suitable for your task, if not you can use Transactional replication.

Make sure both the servers can see each other in order to function the replication.|||This is the main problem,

they can't see each other, they are on separated networks.
I can only transfer files between them.

thanks,|||Originally posted by hushpappy
This is the main problem,

they can't see each other, they are on separated networks.
I can only transfer files between them.

thanks,

Build custom (handmade) replication with DTS.|||Do you have any sample for this kind of thing?
thanks,|||Originally posted by hushpappy
Do you have any sample for this kind of thing?
thanks,

I have no sample for your case (I implemented custom replications for different schemas). Just couple suggestions about how it is possible to do.

1. Use GUI (globally unique identifiers) as primary or unique key for your tables.
2. Because of type replication (something like merge) it needs to have conflict resolver (who is main updater).
3. Create "distribution" database on every server (includes replicated tables twice IN and OUT - empty for first time).
4. Setup triggers on replicated tables (with flag - not fire if update was done by "merge" agent).
5. Add (if not exists) field like last update time to replicated tables.
6. Create "merge" agent for applying changes.

By using DTS you could export data (OUT) from source server to disk (move it to another server ) and import data (IN) to target server.
Update data on target with using conflict resolver. Repeat the same in another direction.

Of course it is just draft for custom replication - real model may be more complicated.|||Originally posted by hushpappy
This is the main problem,

they can't see each other, they are on separated networks.
I can only transfer files between them.

thanks,

You can use merge replication when the two sql servers are on non-trusted networks.

First, the SQL Server Agents must be running under the same user name. This may require you create identical local accounts on both machines to use as the SQL Service agent service Log On account.
Next, on the publisher, add a TCP/IP alias to the subscriber using the Client Network Utility. The server alias needs to be the machine name of the subscriber, and the server name needs to be the IP address of the subscriber.
Finally, create the merge publication and push subscription.

No comments:

Post a Comment