我想要做的是使用 SSIS 将一些信息从 Oracle 11 DB(查询)复制到 SQL Server 2008(单表)。显然我把交易的东西弄混了。虽然当我将事务选项保留为其默认值时一切都执行良好,但在将包事务属性设置为必需(或将数据流组件事务属性之一设置为必需)时出现以下错误。因此,在尝试执行此 DTSX 脚本时,我收到以下错误:
Microsoft (R) SQL Server Execute Package Utility
Version 10.0.2531.0 for 32-bit
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
Started: 11:38:02 §£
Info: 2013-01-16 11:38:02.45
Code: 0x4001100A
Source: issued_import
Description: Starting distributed transaction for this container.
End Info
Info: 2013-01-16 11:38:04.52
Code: 0x4004300A
Source: Data Flow Task 1 SSIS.Pipeline
Description: Validation phase is beginning.
End Info
Info: 2013-01-16 11:38:05.01
Code: 0x40043006
Source: Data Flow Task 1 SSIS.Pipeline
Description: Prepare for Execute phase is beginning.
End Info
Error: 2013-01-16 11:38:05.10
Code: 0xC0047062
Source: Data Flow Task 1 Source - Query [1]
Description: System.InvalidOperationException: Unable to enlist in a distributed transaction
at Oracle.DataAccess.Client.OracleConnection.EnlistTransaction(Transaction transaction)
at Microsoft.SqlServer.Dts.Runtime.ManagedHelper.GetManagedConnection(String assemblyQualifiedName, String connStr, Object transaction)
at Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSConnectionManager100.AcquireConnection(Object pTransaction)
at Microsoft.SqlServer.Dts.Pipeline.DataReaderSourceAdapter.AcquireConnections(Object transaction)
at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostAcquireConnections(IDTSManagedComponentWrapper100 wrapper, Object transaction)
End Error
Error: 2013-01-16 11:38:05.10
Code: 0xC004701A
Source: Data Flow Task 1 SSIS.Pipeline
Description: component "Source - Query" (1) failed the pre-execute phase and returned error code 0x80131509.
End Error
Info: 2013-01-16 11:38:05.10
Code: 0x4004300B
Source: Data Flow Task 1 SSIS.Pipeline
Description: "component "SQL Server Destination" (102)" wrote 0 rows.
End Info
Info: 2013-01-16 11:38:05.10
Code: 0x40043009
Source: Data Flow Task 1 SSIS.Pipeline
Description: Cleanup phase is beginning.
End Info
Info: 2013-01-16 11:38:05.10
Code: 0x4001100C
Source: Data Flow Task 1
Description: Aborting the current distributed transaction.
End Info
Info: 2013-01-16 11:38:05.10
Code: 0x4001100C
Source: issued_import
Description: Aborting the current distributed transaction.
End Info
DTExec: The package execution returned DTSER_FAILURE (1).
Started: 11:38:02 §£
Finished: 11:38:05 §£
Elapsed: 2.823 seconds
请注意,我对执行分布式事务不感兴趣 - 相关服务在 SQL Server 端运行,但我很确定在 Oracle 端没有对此进行任何处理,并且可能分布式事务应该失败。如果是这种情况,还有什么其他方法可以解决这个问题?将我的数据流任务包装到 BEGIN/END TRANSACTION 执行 SQL 块(如建议此处)?