Synchronize 2 tables on 2 servers using triggers

  • Hi,
    I have a table on 2 different servers that I have been asked to synchronize using triggers.
    I have set up a linked server on Server A linking to Server B and I have a linked server on Server B linking to Server A.
    I created Insert,Update and Delete triggers on the table on both servers. In the triggers, I update the table on the linked server.
    When I tried to do an insert into the table on Server A, I received the message "linked server "SERVER B" was unable to begin a distributed transaction. "
    I set up DTC as per this document. https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc753510(v=ws.10)
    now when I do an Insert into Table A, I get this message "Transaction context in use by another session."

    Any help would be appreciated.

  • Replication is the Microsoft way to do this.   Not that there aren't other ways, but you might need to somehow ensure that the session established by the trigger actually ends so that the lock(s?) can be released.  Not sure I'd want to rely on Linked Servers given the availability of replication.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply