在 SSIS 中为脚本任务设置超时选项 [英] Setting timeout option for Script Task in SSIS

查看:46
本文介绍了在 SSIS 中为脚本任务设置超时选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个执行动态创建的 SQL 恢复语句的脚本任务.这在前 6 次运行中没有问题,但随后 .bak 文件变得太大而无法在 30 秒内运行.

I have a script task that executes a dynamically created SQL restore statement. This has worked without a problem for the first 6 runs, but then the .bak files grew too large to run in under 30 sec.

我到处寻找我能想到的超时选项.我已将连接管理器的常规超时重置为 500(据我所知,以秒为单位).这些都没有奏效.

I have looked everywhere I can think of for a timeout option. I have reset the Connection Manager's General Timeout to 500 (from what I understand that is in seconds). None of this has worked yet.

我在哪里/如何设置这个值(或者我可以)?

Where / how do I set this value (or can I)?

投标版本信息:微软 Visual Studio 2008版本 9.0.30729.4462 QFE

BIDS Version Info: Microsoft Visual Studio 2008 Version 9.0.30729.4462 QFE

微软.Net框架版本 3.5 SP1

Microsoft .Net Framework Version 3.5 SP1

推荐答案

您需要发布代码,但很可能不是连接管理器超时,而是查询(它们是不同的超时).假设您使用 SqlCommand 对象来运行查询,请设置 CommandTimeout 超过默认的 30 秒.

You'd need to post your code but it's most likely not the Connection Manager that is timing out but the query (they are different timeouts). Assuming you are using a SqlCommand object to run your query, set the CommandTimeout to something beyond the default 30 seconds.

代码大约

// Set the query execution timeout to 500 seconds
mySqlCommand.CommandTimeout = 500;
mySqlCommand.ExecuteNonQuery();

当然,您会希望成为防御性的代码,但这解决了您需求的症结所在.

Of course, you'll want to be code defensively but this addresses the crux of your need.

这篇关于在 SSIS 中为脚本任务设置超时选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆