我们正在尝试将使用 VB6 开发的 Intranet Web 应用程序从Windows Server 2003迁移到Windows Server 2008 R2,并且我们面临着 Z/OS 大型机上 Microsoft SQL Server 2008 和 DB2 之间的两阶段提交事务的问题。
在安装了 DB2 v9.7.500.702 Fixpack 8(64 位)的 Windows Server 2008 R2 上,在 COM+ 应用程序中注册的 VB6 组件在尝试更新 SQL Server 上的事务一个表和 DB2 上的另一个表时,返回此错误:
[IBM][CLI Driver] SQL0998N 事务或启发式处理期间发生错误。原因代码 = “16”。子代码 = “2-80004005”。SQLSTATE=58005
在 Debug 中运行 VB6 应用程序,在对象(Db2 连接)Open()
上调用方法时引发异常。ADODB.Connection
Db2Diag显示了这一点:
2013-06-26-09.14.15.822000+120 I41317H405 级别:严重
PID:5972 TID:5588 PROC:dllhost.exe
实例:DB2 节点:000
APPID:*LOCAL.DB2.1306260714140626071414 EDUID
:
支持,MicrosoftXARMCreate,probe:364
DATA #1 : String, 69 bytes
HRESULT: 80004005
HRESULT Message: Unspecified error
系统事件查看器报告此:
XA 事务管理器试图加载 XA 资源管理器 DLL。为 XA 资源管理器 DLL 调用 LOADLIBRARY 失败:DLL=C:\PROGRAM FILES\IBM\SQLLIB\BIN\DB2APP.DLL, HR=0x800700c1, File=d:\w7rtm\com\complus\dtc\dtc\xatm \src\xarmconn.cpp 行=2446。
防火墙已关闭。
我已经尝试重新安装 MSDTC。
DTCPing.exe 工作正常。
这是我的 DTC 配置:
我发现这个博客建议更改引用而不是DB2 客户端安装程序通常设置的HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC\XADLL\C:\Program Files\IBM\SQLLIB\BIN\DB2APP.DLL
注册表项。db2app64.dll
db2app.dll
按照建议更改注册表项后,事件查看器错误报告不再显示,但应用程序仍然出现此错误:
[IBM][CLI Driver][DB2] SQL0998N 在事务或启发式处理期间发生错误。原因代码 = “16”。子代码 = “3-8004D00E”。SQLSTATE=58005
Db2Diag显示了这一点:
2013-06-25-12.22.37.192000+120 I39609H572 级别:严重
PID:4364 TID:1804 PROC:dllhost.exe
实例:DB2 节点:000
APPID:*LOCAL.DB2.1306251022380625102238
EDUID:DB2UID
: Support, MicrosoftEnlistWithRM, probe:422
DATA #1 : String, 130 bytes
HRESULT: 8004D00E
HRESULT Message: 事务已被隐式或显式提交或中止
并检查 Db2 跟踪日志报告此错误:
pid=2664 ;tid=2020 ;time=06/25/2013-10:46:11.605 ;seq=94468 ;eventid=TRACING_STARTED ;;"TM Identifier='(null) '" ;"MSDTC is resuming the tracing of long - lived transactions"
pid=2664 ;tid=1764 ;time=06/25/2013-10:46:11.725 ;seq=94469 ;eventid=CHECKPOINTING_STARTED ;;"TM Identifier='(null) '" ;"MSDTC is resuming the checkpointing of transactions "
pid=2664 ;tid=2020 ;time=06/25/2013-10:46:11.624 ;seq=94470 ;eventid=TRANSACTION_BEGUN ;tx_guid=4d2b1dc0-8679-44f2-a649-e440057f2423 ;"TM Identifier='(null) '" ;"transaction has begun, description :'Foo.bstx'"
pid=2664 ;tid=2020 ;time=06/25/2013-10:46:11.624 ;seq=94471 ;eventid=TRANSACTION_PROPOGATED_TO_CHILD_NODE ;tx_guid=4d2b1dc0-8679-44f2-a649-e440057f2423 ;"TM Identifier='(null) '" ;"transaction propagated to 'DVD1SSQ4' as transaction child node #1"
pid=2664 ;tid=2020 ;time=06/25/2013-10:46:11.764 ;seq=94472 ;eventid=RM_ENLISTED_IN_TRANSACTION ;tx_guid=4d2b1dc0-8679-44f2-a649-e440057f2423 ;"TM Identifier='(null) '" ;"resource manager #1002 enlisted as transaction enlistment #1. RM guid = '185bcf6e-85b5-402c-8d43-0368d4c5ee46'"
pid=2664 ;tid=2020 ;time=06/25/2013-10:46:11.858 ;seq=94473 ;eventid=ABORT_DUE_TO_CONNECTION_DOWN_FROM_RM ;tx_guid=4d2b1dc0-8679-44f2-a649-e440057f2423 ;"TM Identifier='(null) '" ;"connection to the resource manager #1002 for transaction enlistment #1 went down"
pid=2664 ;tid=2020 ;time=06/25/2013-10:46:11.858 ;seq=94474 ;eventid=TRANSACTION_ABORTING ;tx_guid=4d2b1dc0-8679-44f2-a649-e440057f2423 ;"TM Identifier='(null) '" ;"transaction is aborting"
pid=2664 ;tid=2020 ;time=06/25/2013-10:46:11.858 ;seq=94475 ;eventid=CHILD_NODE_ISSUED_ABORT ;tx_guid=4d2b1dc0-8679-44f2-a649-e440057f2423 ;"TM Identifier='(null) '" ;"abort request issued to transaction child node #1 'DVD1SSQ4'"
pid=2664 ;tid=2020 ;time=06/25/2013-10:46:11.858 ;seq=94476 ;eventid=CHILD_NODE_ACKNOWLEDGED_ABORT ;tx_guid=4d2b1dc0-8679-44f2-a649-e440057f2423 ;"TM Identifier='(null) '" ;"received acknowledgement of abort request from transaction child node #1 'DVD1SSQ4'"
pid=2664 ;tid=2020 ;time=06/25/2013-10:46:11.858 ;seq=94477 ;eventid=TRANSACTION_ABORTED ;tx_guid=4d2b1dc0-8679-44f2-a649-e440057f2423 ;"TM Identifier='(null) '" ;"transaction has been aborted"
pid=2664 ;tid=2020 ;time=06/25/2013-10:46:11.837 ;seq=94478 ;eventid=RM_ENLIST_FAILED_TRANSACTION_NOT_FOUND ;tx_guid=4d2b1dc0-8679-44f2-a649-e440057f2423 ;"TM Identifier='(null) '" ;"attempt to enlist the resource manager failed cause the transaction could not be found. Some possible reasons include, client might have already called commit or transaction might have got aborted due to timeout. RM guid = 'aa265ceb-27b0-4de0-999b-80b58dee4af8'"
在 MS DTC 上启用诊断跟踪,我们只得到这个条目:
06-25-2013 12:43:17:746 : [ a68.132c] 0x00000000 [ TRACE_XA] [TRACE_VERBOSE] LookUpXaDllPath (d:\w7rtm\com\complus\dtc\dtc\xatm\src\xatmdll.cpp@175): Looking up XA DLL 'C:\PROGRAM FILES\IBM\SQLLIB\BIN\DB2APP.DLL'
06-25-2013 12:43:17:746 : [ a68.132c] 0x00000000 [ TRACE_XA] [TRACE_VERBOSE] LookUpXaDllPath (d:\w7rtm\com\complus\dtc\dtc\xatm\src\xatmdll.cpp@294): Xa DLL Lookup completed, HR=00000000, Path='C:\Program Files\IBM\SQLLIB\BIN\DB2APP64.DLL'
06-25-2013 12:43:17:746 : [ a68. 6e4] 0x00000000 [ TRACE_XA] [TRACE_VERBOSE] CValidateTask::TaskRoutine (d:\w7rtm\com\complus\dtc\dtc\xatm\src\xataskmgr.cpp@1915): CValidateTask::TaskRoutine - calling xa_open - DLL=C:\PROGRAM FILES\IBM\SQLLIB\BIN\DB2APP.DLL, OpenString="DB=FOO,UID=FOO,PWD=FOO,TPM=MSDTC"
06-25-2013 12:43:17:777 : [ a68. 6e4] 0x00000000 [ TRACE_XA] [TRACE_VERBOSE] CValidateTask::TaskRoutine (d:\w7rtm\com\complus\dtc\dtc\xatm\src\xataskmgr.cpp@1919): CValidateTask::TaskRoutine - returned from xa_open with error=0 - DLL=C:\PROGRAM FILES\IBM\SQLLIB\BIN\DB2APP.DLL, OpenString="DB=FOO,UID=FOO,PWD=FOO,TPM=MSDTC"
06-25-2013 12:43:17:777 : [ a68. 6e4] 0x00000000 [ TRACE_XA] [TRACE_VERBOSE] CValidateTask::TaskRoutine (d:\w7rtm\com\complus\dtc\dtc\xatm\src\xataskmgr.cpp@1934): CValidateTask::TaskRoutine - calling xa_close - DLL=C:\PROGRAM FILES\IBM\SQLLIB\BIN\DB2APP.DLL
06-25-2013 12:43:17:777 : [ a68. 6e4] 0x00000000 [ TRACE_XA] [TRACE_VERBOSE] CValidateTask::TaskRoutine (d:\w7rtm\com\complus\dtc\dtc\xatm\src\xataskmgr.cpp@1943): CValidateTask::TaskRoutine - returned from xa_close with error=0 - DLL=C:\PROGRAM FILES\IBM\SQLLIB\BIN\DB2APP.DLL
06-25-2013 12:43:17:855 : [ a68.156c] 0x00000000 [ TRACE_XA] [TRACE_VERBOSE] LookUpXaDllPath (d:\w7rtm\com\complus\dtc\dtc\xatm\src\xatmdll.cpp@175): Looking up XA DLL 'C:\PROGRAM FILES\IBM\SQLLIB\BIN\DB2APP.DLL'
06-25-2013 12:43:17:855 : [ a68.156c] 0x00000000 [ TRACE_XA] [TRACE_VERBOSE] LookUpXaDllPath (d:\w7rtm\com\complus\dtc\dtc\xatm\src\xatmdll.cpp@294): Xa DLL Lookup completed, HR=00000000, Path='C:\Program Files\IBM\SQLLIB\BIN\DB2APP64.DLL'
06-25-2013 12:43:17:855 : [ a68. 6e4] 0x00000000 [ TRACE_XA] [TRACE_VERBOSE] CValidateTask::TaskRoutine (d:\w7rtm\com\complus\dtc\dtc\xatm\src\xataskmgr.cpp@1915): CValidateTask::TaskRoutine - calling xa_open - DLL=C:\PROGRAM FILES\IBM\SQLLIB\BIN\DB2APP.DLL, OpenString="DB=FOO,UID=FOO,PWD=FOO,TPM=MSDTC"
06-25-2013 12:43:17:886 : [ a68. 6e4] 0x00000000 [ TRACE_XA] [TRACE_VERBOSE] CValidateTask::TaskRoutine (d:\w7rtm\com\complus\dtc\dtc\xatm\src\xataskmgr.cpp@1919): CValidateTask::TaskRoutine - returned from xa_open with error=0 - DLL=C:\PROGRAM FILES\IBM\SQLLIB\BIN\DB2APP.DLL, OpenString="DB=FOO,UID=FOO,PWD=FOO,TPM=MSDTC"
06-25-2013 12:43:17:886 : [ a68. 6e4] 0x00000000 [ TRACE_XA] [TRACE_VERBOSE] CValidateTask::TaskRoutine (d:\w7rtm\com\complus\dtc\dtc\xatm\src\xataskmgr.cpp@1934): CValidateTask::TaskRoutine - calling xa_close - DLL=C:\PROGRAM FILES\IBM\SQLLIB\BIN\DB2APP.DLL
06-25-2013 12:43:17:886 : [ a68. 6e4] 0x00000000 [ TRACE_XA] [TRACE_VERBOSE] CValidateTask::TaskRoutine (d:\w7rtm\com\complus\dtc\dtc\xatm\src\xataskmgr.cpp@1943): CValidateTask::TaskRoutine - returned from xa_close with error=0 - DLL=C:\PROGRAM FILES\IBM\SQLLIB\BIN\DB2APP.DLL
使用该标志运行testconn20.exe或testconn32.exe-dtc
,XA 连接测试通过且没有错误。
...
步骤 4:从 SYSIBM.systables 中选择行以验证包的存在
SELECT * FROM SYSIBM.systables FETCH FIRST 5 rows only
Elapsed: 0.0468015第 5 步:为表调用 GetSchema 以验证模式函数的存在
已过:1.5132485第 6 步:创建 XA 连接
DB2TransactionScope:连接已关闭。
经过:2.152869
测试通过。
在安装了 Windows Server 2003 和 Db2 9.5.800.186 FixPack8(32 位)的旧服务器上,一切顺利,没有任何问题;运行相同应用程序的 db2 跟踪日志显示:
pid=5188 ;tid=4516 ;time=06/25/2013-11:52:12.382 ;seq=5 ;eventid=TRACING_STARTED ;;"TM Identifier='(null) '" ;"MSDTC is resuming the tracing of long - lived transactions"
pid=5188 ;tid=1536 ;time=06/25/2013-11:52:12.616 ;seq=6 ;eventid=CHECKPOINTING_STARTED ;;"TM Identifier='(null) '" ;"MSDTC is resuming the checkpointing of transactions "
pid=5188 ;tid=4516 ;time=06/25/2013-11:52:12.382 ;seq=7 ;eventid=TRANSACTION_BEGUN ;tx_guid=16bfbb83-9b31-4c59-a06f-c5b59978f0ca ;"TM Identifier='(null) '" ;"transaction has begun, description :'Foo.bstx'"
pid=5188 ;tid=4352 ;time=06/25/2013-11:52:12.382 ;seq=8 ;eventid=TRANSACTION_PROPOGATED_TO_CHILD_NODE ;tx_guid=16bfbb83-9b31-4c59-a06f-c5b59978f0ca ;"TM Identifier='(null) '" ;"transaction propagated to 'DVD1SSQ4' as transaction child node #1"
pid=5188 ;tid=4516 ;time=06/25/2013-11:52:12.647 ;seq=9 ;eventid=RM_ENLISTED_IN_TRANSACTION ;tx_guid=16bfbb83-9b31-4c59-a06f-c5b59978f0ca ;"TM Identifier='(null) '" ;"resource manager #1001 enlisted as transaction enlistment #1. RM guid = '3a1e3c78-a7ac-40f4-9101-d0506d78c405'"
pid=5188 ;tid=5360 ;time=06/25/2013-11:52:12.913 ;seq=10 ;eventid=RECEIVED_COMMIT_REQUEST_FROM_BEGINNER ;tx_guid=16bfbb83-9b31-4c59-a06f-c5b59978f0ca ;"TM Identifier='(null) '" ;"received request to commit the transaction from beginner"
pid=5188 ;tid=5360 ;time=06/25/2013-11:52:12.913 ;seq=11 ;eventid=CHILD_NODE_ISSUED_PREPARE ;tx_guid=16bfbb83-9b31-4c59-a06f-c5b59978f0ca ;"TM Identifier='(null) '" ;"prepare request issued to transaction child node #1 'DVD1SSQ4'"
pid=5188 ;tid=5360 ;time=06/25/2013-11:52:12.913 ;seq=12 ;eventid=RM_ISSUED_PREPARE ;tx_guid=16bfbb83-9b31-4c59-a06f-c5b59978f0ca ;"TM Identifier='(null) '" ;"prepare request issued to resource manager #1001 for transaction enlistment #1"
pid=5188 ;tid=4352 ;time=06/25/2013-11:52:12.928 ;seq=13 ;eventid=CHILD_NODE_VOTED_COMMIT ;tx_guid=16bfbb83-9b31-4c59-a06f-c5b59978f0ca ;"TM Identifier='(null) '" ;"transaction child node #1 'DVD1SSQ4' voted commit"
pid=5188 ;tid=4516 ;time=06/25/2013-11:52:12.928 ;seq=14 ;eventid=RM_VOTED_COMMIT ;tx_guid=16bfbb83-9b31-4c59-a06f-c5b59978f0ca ;"TM Identifier='(null) '" ;"resource manager #1001 voted commit for transaction enlistment #1"
pid=5188 ;tid=1932 ;time=06/25/2013-11:52:12.944 ;seq=15 ;eventid=TRANSACTION_COMMITTED ;tx_guid=16bfbb83-9b31-4c59-a06f-c5b59978f0ca ;"TM Identifier='(null) '" ;"transaction has got committed"
pid=5188 ;tid=1932 ;time=06/25/2013-11:52:12.944 ;seq=16 ;eventid=CHILD_NODE_ISSUED_COMMIT ;tx_guid=16bfbb83-9b31-4c59-a06f-c5b59978f0ca ;"TM Identifier='(null) '" ;"commit request issued to transaction child node #1 'DVD1SSQ4'"
pid=5188 ;tid=1932 ;time=06/25/2013-11:52:12.944 ;seq=17 ;eventid=RM_ISSUED_COMMIT ;tx_guid=16bfbb83-9b31-4c59-a06f-c5b59978f0ca ;"TM Identifier='(null) '" ;"commit request issued to resource manager #1001 for transaction enlistment #1"
pid=5188 ;tid=4352 ;time=06/25/2013-11:52:12.944 ;seq=18 ;eventid=CHILD_NODE_ACKNOWLEDGED_COMMIT ;tx_guid=16bfbb83-9b31-4c59-a06f-c5b59978f0ca ;"TM Identifier='(null) '" ;"received acknowledgement of commit request from transaction child node #1 'DVD1SSQ4'"
pid=5188 ;tid=4736 ;time=06/25/2013-11:52:12.944 ;seq=19 ;eventid=RM_ACKNOWLEDGED_COMMIT ;tx_guid=16bfbb83-9b31-4c59-a06f-c5b59978f0ca ;"TM Identifier='(null) '" ;"received acknowledgement of commit request from the resource manager #1001 for transaction enlistment #1"
pid=5188 ;tid=4056 ;time=06/25/2013-11:53:07.118 ;seq=20 ;eventid=TRACING_STOPPED ;;"TM Identifier='(null) '" ;"MSDTC is suspending the tracing of long - lived transactions due to lack of activity"
您知道 MSDTC(64 位)是否支持从 32 位应用程序(Dllhost.exe 32 位或 Vb6.exe 32 位)调用的 2 阶段提交事务?
TestConn32.exe可以正常工作并通过 dtc 测试(在上述 Db2app64.dll 修复之后),因此它似乎不是 32 位兼容性问题。
我已经尝试将 DB2 驱动程序从 32 位更改为 64 位,但问题仍然存在。
有什么提示吗?