I have two SQL Servers that are linked. They can browse each other's contents in Enterprise Manager/SQL Management Studio. I can communicate between them using T-SQL statements. But Server A's trigger doesn't insert a new row in a database table on Server
B.
Here are some specifics:
- Server A is SQL 2000. Server B is SQL 2008.
- The servers are linked to one another with the sa remote login on each machine.
- I have enabled all RPC communication in both servers' DTC settings.
- I have disabled authentication requirements on both servers' DTC settings.
- The DTC service on both servers is running.
- I can communicate fine using the DTCTester.exe program, going from Server A to Server B.
Here is a snippet from the DTCTester.exe output below:
Executed: dtctester
DSN: WORM
User Name: sa
Password: xxxxx
tablename= #dtc7290
Creating Temp Table for Testing: #dtc7290
Warning: No Columns in Result Set From Executing: 'create table #dtc7290 (ival int)'
Initializing DTC
Beginning DTC Transaction
Enlisting Connection in Transaction
Executing SQL Statement in DTC Transaction
Inserting into Temp...insert into #dtc7290 values (1)
Warning: No Columns in Result Set From Executing: 'insert into #dtc7290 values (1) '
Verifying Insert into Temp...select * from #dtc7290 (should be 1): 1
Press enter to commit transaction.
Commiting DTC Transaction
Releasing DTC Interface Pointers
Successfully Released pTransaction Pointer.
Disconnecting from Database and Cleaning up Handles
Here is a snippet from the dtctrace.log file showing when the issue occurs during the trigger that's fired on Server A. Looking at Server A's live data stream in a Profiler trace I don't even see the trigger's code being fired.
pid=3164 ;tid=2872 ;time=03/27/2012-13:09:08.512 ;seq=97 ;eventid=TRACE_SETTINGS
;;"Trace Configuration (OFF = 0 and ON = 1): Tracing Of DTC = 1, Tracing Of Transactions = 1, Tracing Of Aborted Transactions = 1, Tracing Of Long-Lived Transactions = 1, Tracing Of All Transactions = 1, Max Limit on Memory Buffers = 25."
pid=3164 ;tid=1732 ;time=03/27/2012-13:11:39.120 ;seq=98 ;eventid=TRACING_STARTED
;;"MSDTC is resuming the tracing of long - lived transactions"
pid=3164 ;tid=1732 ;time=03/27/2012-13:11:39.120 ;seq=99 ;eventid=TRANSACTION_BEGUN
;tx_guid=9c1bd5cb-14d4-4c18-912f-62fb98ed9a0c ;"transaction got begun, description : 'Trans1'"
pid=3164 ;tid=2316 ;time=03/27/2012-13:11:39.120 ;seq=100 ;eventid=RM_ENLISTED_IN_TRANSACTION
;tx_guid=9c1bd5cb-14d4-4c18-912f-62fb98ed9a0c ;"resource manager #1001 enlisted as transaction enlistment #1. RM guid = '141451b5-4d22-40f4-a392-b62f5317bfa4'"
pid=3164 ;tid=3172 ;time=03/27/2012-13:11:39.120 ;seq=101 ;eventid=RECEIVED_ABORT_REQUEST_FROM_BEGINNER ;tx_guid=9c1bd5cb-14d4-4c18-912f-62fb98ed9a0c
;"received request to abort the transaction from beginner"
pid=3164 ;tid=3172 ;time=03/27/2012-13:11:39.120 ;seq=102 ;eventid=TRANSACTION_ABORTING
;tx_guid=9c1bd5cb-14d4-4c18-912f-62fb98ed9a0c ;"transaction is aborting"
pid=3164 ;tid=3172 ;time=03/27/2012-13:11:39.120 ;seq=103 ;eventid=RM_ISSUED_ABORT
;tx_guid=9c1bd5cb-14d4-4c18-912f-62fb98ed9a0c ;"abort request issued to resource manager #1001 for transaction enlistment #1"
pid=3164 ;tid=1732 ;time=03/27/2012-13:11:39.120 ;seq=104 ;eventid=RM_ACKNOWLEDGED_ABORT
;tx_guid=9c1bd5cb-14d4-4c18-912f-62fb98ed9a0c ;"received acknowledgement of abort request from the resource manager #1001 for transaction enlistment #1"
pid=3164 ;tid=1732 ;time=03/27/2012-13:11:39.120 ;seq=105 ;eventid=TRANSACTION_ABORTED
;tx_guid=9c1bd5cb-14d4-4c18-912f-62fb98ed9a0c ;"transaction has been aborted"
pid=3164 ;tid=756 ;time=03/27/2012-13:12:33.853 ;seq=106 ;eventid=TRACING_STOPPED
;;"MSDTC is suspending the tracing of long - lived transactions due to lack of activity"
Finally, here is the code for the trigger on Server A, as well as the stored procedure that it should communicate with on Server B.
Server A:
USE [dbsARMS_B01]
GO
/****** Object: Trigger [dbo].[trgNewRepairJob] Script Date: 03/27/2012 15:31:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[trgNewRepairJob] ON [dbo].[tbl482_RepairJob]
FOR INSERT
AS
DECLARE @pJobNo varchar(255)
DECLARE @pSiteId varchar(2)
BEGIN
SELECT
@pJobNo = JobNo
,@pSiteId = CAST(SiteId as varchar(2))
FROM inserted
BEGIN DISTRIBUTED TRANSACTION;
EXEC [WORM].dcdev.dbo.spcNewRepairJob @pJobNo, @pSiteId;
COMMIT TRAN;
END
----------------------
Server B:
USE [dcdev]
GO
/****** Object: StoredProcedure [dbo].[spcNewRepairJob] Script Date: 03/27/2012 15:33:17 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Procedure [dbo].[spcNewRepairJob]
(
@pJobNo varchar(255),
@pSiteId varchar(2)
)
As
set nocount on
Insert into [dcdev].[dbo].[tblRepairJobs](JobNumber, SiteId, Printed)
Values(@pJobNo, @pSiteId, 0)
Any suggestions? I have tried every which way the past two days and spent at least 3 hours researching similar issues. Any help would mean a lot. Thanks!