当我在[RemoteServer]链接服务器上执行这个查询时,它运行得很好:
INSERT INTO [RemoteServer].[DbName].[SchemaName].[TableName] VALUES (1, 'bar');但是,当将它放入事务中时,它就不再起作用了:
BEGIN TRANSACTION
BEGIN TRY
INSERT INTO [RemoteServer].[DbName].[SchemaName].[TableName] VALUES (1, 'bar');
COMMIT TRANSACTION
PRINT 'insert done!';
END TRY
BEGIN CATCH
PRINT 'insert faild!';
PRINT 'Error Message: ' + ERROR_MESSAGE();
ROLLBACK TRANSACTION
END CATCHRPC和RPC OUT是链接服务器上的true。
当我在客户端上执行secound脚本时,超时后显示以下消息:
OLE DB provider "SQLNCLI11" for linked server "RemoteServer" returned message "No transaction is active.".
(0 row(s) affected)
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.发布于 2015-04-06 13:09:56
Windows防火墙似乎阻止了DTC包。若要允许它通过Windows进行通信,请转到“控制面板”>“Windows防火墙”>“允许的应用程序”和“应用程序列表”,检查Distributed Transaction Coordinator中的Private (或必要时为Public )网络。
如果它不适用于您,请查看以下解决方案:
https://dba.stackexchange.com/questions/97106
复制相似问题