Solved

triggers operating on synchronous replicated server

Posted on 2013-01-14
2
226 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
2 Comments
 
LVL 28

Accepted Solution

by:
Ryan McCauley earned 500 total points
Comment Utility
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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now