Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 2 way sql server table replication

Author  Topic 

still_the_same
Starting Member

3 Posts

Posted - 2011-06-23 : 15:13:32
Hi,

For a client I need to build a web application. Normally I build my applications front and backend on the same database. In this scenario we have 2 databases, 1 in the DMZ with the website and 1 in the backend application. In both databases there are a couple of tables that need to be in sync. If an update is made to one of the tables on either server that same update needs to be performed on the other server in the same table. All the tables have no referential constrains to other tables. Is this possible to do in sql server? I know that it would be more efficient to create one database server for the tables but this is due to policies not allowed.
Patrick

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-06-23 : 15:19:31
Yes, you can use transactional replication for this.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

still_the_same
Starting Member

3 Posts

Posted - 2011-06-23 : 15:27:23
Thanks for your quick reply. When I search for transactional replication I see that there are multiple types. Is there a good document that describes how to create solid bidirectional transactional replication?

Patrick
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-06-23 : 15:28:35
I don't have any documentation/links handy, but there is plenty of information regarding it out there.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-06-23 : 17:34:53
What you're looking for is called Peer to Peer Replication.

(don't use Transactional Replication With Updateable Subscriptions -- it's almost obsolete).

See here and here

Be very careful with any tables that have identity columns. You'll need to seed them in a way that you won't have collisions. For just two servers, one can be odd and the other even for example. If this is a scaleout project and data already exists, you'll need to have a good hard look at how to avoid PK collisions.

There are a handful of other gotchas with Peer to Peer, but all in all, it's pretty easy and painless.

After reading the documentation in the link above, post back with any other questions.
Go to Top of Page

still_the_same
Starting Member

3 Posts

Posted - 2011-06-24 : 03:32:14
Thanks for the input. Ill look into it. If I have any further questions I'll let you know.
Go to Top of Page
   

- Advertisement -