Solved

triggers operating on synchronous replicated server

Posted on 2013-01-14
2
232 Views
Last Modified: 2013-01-21
I am (unfortunately) using SQL-Server 2005.

I am working on an application which needs to track changes to a sql-server database. I have written triggers for the sql database that record the necessary details in new tables, which the application then reads, then modifies to indicate that they have 'synced'. (i.e.: There is a synced column which defaults to 0, then when the application has read it, the application sets the column to 1)

The application will read the data from a sql-server that is replicated (synchronously) from the main database. Like this:

Office sql-server  ----->   sql-server B <-------> Application

The only information that the application commits to the sql-server B is to change the synced columns from 0 to 1 when it has read them.

Is there a way to have the triggers fire on sql-serverB only, for changes made to tables on the office server?

I have 2 reasons for wanting this:

1) server load: Some of the triggers query complex views, so i'd rather that processing was done by sql-server B.
2) safety: We want to modify the office sql-server as little as possible. The office server is mission critical, sql-server B is not.
0
Comment
Question by:rdun25
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 28

Accepted Solution

by:
Ryan McCauley earned 500 total points
ID: 38784429
I'm a little unclear on your configuration here - are you using native SQL Server replication (and if you are, are you using transactional replication or one of the other methods?) or have you rolled your own replication engine (using triggers)? If you're using transactional replication, it only plans changed data from the first server to the second, and you're free to issue whatever updates you want against the destination table as part of any other support process you want. In this case, you can replication your row from Server A -> B, have an application read the table on Server B, and then modify the "processed" column on Server B and set it to true. As long as nothing on Server A modifies that column on Server A afterwards, there's no issue - you can even update the table on server A and change any other values if you want, and it will replicate those changes, but it won't reset the value on the "processed" column.

If you've rolled your own replication, how is it set up? Why roll it on your own instead of using the native replication processes? You're effectively managing a queue of table changes here, and that can get more complicated if you've got anything more than very simple requirements (especially if your application that's reading the changes from Server B is multi-threaded).

If I haven't answered your question above, please provide some more detail about your configuration and I'm happy to give advice to your particular situation.
0
 

Author Comment

by:rdun25
ID: 38803557
I am very sorry about the late response.

First off, thank you, you have answered the question I needed answered. I'm sorry I wasn't clear enough about what exactly I was after.

Yes, I'm using transactional replication from server A -> B. However, the application does not have a sql database (it uses couchDB, long story). It is for the server b -> application interaction that I needed to write the triggers.

I will write a separate question to deal with the issues that come up from this.
0

Featured Post

Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question