当我尝试使用" BEGIN DISTRIBUTED TRANSACTION"从链接服务器调用storedprocedure时命令,我收到以下错误。
OLE DB provider "OraOLEDB.Oracle" for linked server "LINKSERVER2" returned message "New transaction cannot enlist in the specified transaction coordinator. ".
Msg 7391, Level 16, State 2, Line 4
The operation could not be performed because OLE DB provider "OraOLEDB.Oracle" for linked server "LINKSERVER2" was unable to begin a distributed transaction.
当我这样跑时,程序通过。
set @sql= 'begin INSERT INTO FEED.K_PACKING_CHARGE(org_code , sale_packing_size , amount)
VALUES (''2'' , ''100'' , ''3''); end;'
exec (@sql) AT LINKSERVER_1 ;
但是当我尝试添加"开始分发交易"命令,我收到错误
BEGIN DISTRIBUTED TRAN
set @sql= 'begin INSERT INTO FEED.K_PACKING_CHARGE(org_code , sale_packing_size , amount)
VALUES (''2'' , ''100'' , ''3''); end;'
exec (@sql) AT LINKSERVER_1 ;
COMMIT
如果我在某台计算机上运行创建链接服务器,则没有问题。但是我使用两台计算机(一台是MSSQL服务器,另一台是Oracle数据库),我收到错误。