gpt4 book ai didi

sql-server - SSIS 运行时存储过程失败

转载 作者:行者123 更新时间:2023-12-04 01:08:06 24 4
gpt4 key购买 nike

我在 SSIS 中有一个执行 SQL 步骤不一致地失败并出现以下错误:

[Execute SQL Task] Error: Executing the query "sp name" failed with the following error: "The statement has been terminated.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

存储过程截断一个表,然后使用 tablock 将数据插入其中。它没有参数化,也不返回记录集。

  • 存储过程在 SSMS 中成功执行。
  • 我在 visual studio 中以 Debug模式在我的用户下运行 SSIS。
  • 我在这个本地桌面开发箱上有系统管理员。
  • 四项任务中的任何一项都可能失败。
  • 如果容器独立于包的其余部分执行,它就可以工作。
  • 连接字符串是一个 ole db 连接到同一个盒子上的数据库。

发生这种情况的流程如下所示,所有四个调用不同但相似的过程,它们都将数据从同一个表加载到四个不同的目标:

enter image description here

其他信息:

  • SQL Server 2016 SP1,开发人员版
  • Windows 8.1

编辑:

存储过程是这样的:

create or alter myprocedure as

truncate table mytable

insert into mytable with (tablock)
(col1,col2,col3,col4,col5 ... col30)
select
try_cast(col1 as something) as col1
,try_cast(col2 as something) as col2
,try_cast(col3 as something) as col3
,col4
,col5
...
,col30
from
myothertable

编辑:我有另一个几乎相同的过程 - 除非它针对不同的文件进行导入。它没有问题。文件比 15GB 小 10Gb。

编辑:SQL 错误日志中有一些堆栈转储:

  • BEGIN STACK DUMP:
  • 03/04/17 17:39:43 spid 11668
    • Location: AllocPageRef.cpp:2436
  • Expression: IAM_START_PGID (ext_id, ext_size) == startExtId
  • SPID: 77
  • Process ID: 7836
  • Description: Looking for extent in wrong IAM page
    • Input Buffer 70 bytes -
  • exec my_sp

是时候运行更多 DBCC 命令了。

最佳答案

您是否在任何其他程序中引用了“myothertable”?您是否检查过包和容器的默认事务处理是如何设置的?如果您正在使用 tablock 并且处于嵌套事务中(如果它全部默认),您可能会立即陷入僵局。

关于sql-server - SSIS 运行时存储过程失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42584183/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com