ssis 包配置组织程序

There are many reasons for terminating a long running SSIS Package. Picture a scenario whereby an inexperienced DBA/developer accidentally kicks-off a monthly job instead of a daily job, inadvertently impacting SQL Server performance. Whatever the reasons, you are more than likely to encounter a situation in which you have to temporary stop a long running process.

终止长时间运行的SSIS程序包的原因很多。 设想一下一个场景,在该场景中,经验不足的DBA /开发人员会意外地启动每月工作而不是日常工作,从而无意中影响了SQL Server的性能。 无论出于何种原因,您很有可能会遇到不得不暂时停止长时间运行的过程的情况。

Although SQL Server makes it easy to terminate undesired processes, you are likely to receive ambiguous error log messages for your actions depending on the mechanism used to terminate that process. In this article we take a look at how stopping a long running Integrations Services Catalog package can be logged differently when doing it from SQL Server Management Studio (SSMS) versus Integration Services Server (ISS).

尽管SQL Server可以很容易地终止不需要的进程,但是根据终止该进程所使用的机制,您可能会收到有关操作的模棱两可的错误日志消息。 在本文中,我们将研究如何从SQL Server Management Studio (SSMS)与Integration Services Server(ISS)来记录停止长时间运行的Integrations Catalog软件包的情况。

一个例子 (A case in point)

To simulate a long running package, I setup an SSIS demo project that contains Package Sleep.dtsx which uses a Script Task. The Script Task uses a Thread.Sleep method to add a 10-minute time delay for every package execution. The main method of the Package Sleep.dtsx is shown in Script 1.

为了模拟长时间运行的软件包,我设置了一个SSIS演示项目,其中包含使用脚本任务的 Package Sleep.dtsx 脚本任务使用Thread.Sleep方法为每个程序包执行添加10分钟的时间延迟。 脚本1显示了Package Sleep.dtsx的主要方法。


public void Main(){Thread.Sleep(600000);Dts.TaskResult = (int)ScriptResults.Success;}

Script 1

脚本1

My SSIS demo project was then deployed into a local instance of SQL Server 2016 and a SQL Agent job – SSISDemoJob – Sleep – was created with a single step whose sole purpose is to execute the Package Sleep.dtsx. Figure 1 shows the location of the newly deployed SSISDemo project and newly created SSISDemoJob – Sleep.

然后,将我的SSIS演示项目部署到SQL Server 2016的本地实例中,并通过一个步骤创建了SQL Agent作业 SSISDemoJob-Sleep ,其唯一目的是执行Package Sleep.dtsx图1显示了新部署的SSISDemo项目和新创建的SSISDemoJob – Sleep的位置

Integrations Services Catalog has a built-in All Executions report that basically list recent executions. We will be using this report to retrieve details about the package execution. The report can be accessed as shown in Figure 2.

Integrations Services目录具有内置的“ 所有执行”报告 ,该报告基本上列出了最近的执行情况。 我们将使用此报告来检索有关程序包执行的详细信息。 可以如图2所示访问该报告。

  1. Cancel package execution from SSMS

    从SSMS取消软件包执行

    Let’s start off by running the job SSISDemoJob – Sleep. Say we are later informed that we shouldn’t have run this job and as a result we have to stop it. All that is required to stop it, is by simply clicking the Stop Job option as shown in Figure 3.

    让我们从运行作业SSISDemoJob – Sleep开始 。 假设我们后来被告知我们不应该运行此作业,因此我们必须停止它。 要停止它,所需要做的就是简单地单击Stop Job选项, 如图3所示。

    Figure 3 图3

    Now, if we go through All Executions report, we can notice that stopping the SQL Agent job generated an Unexpected Termination status as shown in Figure 4.

    现在,如果我们浏览All Executions报告 ,我们可以注意到停止SQL Agent作业会生成意外终止状态, 如图4所示。

    Figure 4 图4

    The error message logged in the Catalog is in contrast to the message logged in the SQL Agent job as it can be seen in Figure 5 – the agent log is more accurate as we did stop the job.

    从目录库中记录的错误消息与在SQL Agent作业中记录的错误消息相反, 如图5所示 –由于我们确实停止了作业,因此代理程序日志更加准确。

    Figure 5 图5

    Stopping package execution by clicking the Stop operation in SQL Agent is equivalent to running a Kill T-SQL command. To demonstrate this, I reran the SSISDemoJob – Sleep again. Instead of clicking the Stop Job option in the SQL Agent, I retrieved the process id (58) for this operation from Activity Monitor as shown in Figure 6.

    通过单击SQL Agent中的“停止”操作来停止程序包执行等同于运行Kill T-SQL命令。 为了演示这一点,我重新运行了SSISDemoJob –再次睡眠 。 我没有单击SQL Agent中的Stop Job选项,而是从Activity Monitor中检索了此操作的进程ID(58), 如图6所示。

    Figure 6 图6

    I then ran a T-SQL Kill command as shown in Script 2.

    然后,我运行了一个T-SQL Kill命令,如脚本2所示。

    Script 2 剧本2

    As it can be seen in Figure 7, the killing of process id 58 led to the same message being logged as when we had stopped the execution using the SQL Agent – Unexpected Termination.

    如图7所示 ,进程ID 58的终止导致记录与我们使用SQL Agent – 意外终止终止执行时相同的消息。

    Figure 7 图7

    What is more impressive however, is that the SQL Agent is again correctly logging what happened to the execution of this job. As it can be seen in Figure 8 – the reason the job (and subsequently the package) was terminated was because of a kill state that was invoked.

    但是,更令人印象深刻的是,SQL Agent再次正确地记录了执行此作业的过程。 从图8可以看出,作业(以及随后的程序包)被终止的原因是由于调用了kill状态。

    Figure 8 图8

  2. Cancel package execution from SSISDB

    从SSISDB取消软件包执行

    The previous section demonstrated that when package execution is terminated within SSMS (i.e. SQL Agent Job or T-SQL KILL command) then you should use the information logged in SQL Agent job history to learn more on the causes of the termination. In this section we take a look at the various options to terminate a package within Integration Services Server (ISS). Again, we go back to SQL Agent job and rerun SSISDemoJob – Sleep.

    上一节演示了在SSMS中终止程序包执行时(即SQL Agent Job或T-SQL KILL命令),则应使用SQL Agent作业历史记录中记录的信息来了解有关终止原因的更多信息。 在本节中,我们将介绍在Integration Services服务器(ISS)中终止程序包的各种选项。 再次,我们返回到SQL Agent作业并重新运行SSISDemoJob – Sleep

    ISS’s SSISDB keeps track of all operations that are currently active/executing. In order to retrieve a list of all active operations, you need to right click SSISDB and choose Active Operations as shown in Figure 9.

    ISS的SSISDB跟踪当前处于活动/执行状态的所有操作。 为了检索所有活动操作的列表,您需要右键单击SSISDB并选择“活动操作”, 如图9所示。

    Figure 9 图9

    The Active Operations window comes up as shown in Figure 10. You can then click the Stop button located at the bottom right of the window.

    出现“活动操作”窗口, 如图10所示。 然后,您可以单击窗口右下方的“停止”按钮。

    Figure 10 图10

    Now let’s take a look at the status of the message that is logged following what we did. As it can be seen in Figure 11, a Canceled status was generated for stopping the package execution via the Active Operations window.

    现在,让我们看一下执行此操作后记录的消息状态。 如图11所示 ,已生成“已取消”状态,用于通过“活动操作”窗口停止包执行。

    Figure 11 图11

    When we go back to the SQL Agent, we can see in Figure 12 that the job was stopped due to failure but the error message of the job goes a step further and advises that a source of the error came from the IS Server and further suggests that you go through the All Executions report for more information.

    当我们返回到SQL Agent时,我们可以在图12中看到该作业由于失败而停止,但是该作业的错误消息又走了一步,并建议错误源来自IS Server,并进一步建议您可以通过“ 所有执行”报告查看更多信息。

    Figure 12 图12

    Similarly to using a Kill command, you can stop an operation in the ISS by using the T-SQL command. SSISDB has a built-in stored procedure called [catalog].[stop_operation] in which as the name suggests – stops an active operation. Thus, all that happened when you click the Stop button in Active Operations dialog box was essentially execute the stop operation stored procedure.

    与使用Kill命令类似,您可以使用T-SQL命令在ISS中停止操作。 SSISDB具有一个名为[catalog]。[stop_operation]的内置存储过程,顾名思义,该存储过程将停止活动操作。 因此,当您单击“活动操作”对话框中的“停止”按钮时,所发生的一切实质上就是执行停止操作存储过程。

    To demonstrate this, I reran the SSISDemoJob – Sleep job again. I also got a list of active operations in SSISDB but instead of clicking the Stop button I took note of the operations ID as shown in Figure 13 (in my case, the operation id is 20038).

    为了演示这一点,我再次重新运行了SSISDemoJob –睡眠作业。 我还获得了SSISDB中活动操作的列表,但没有单击Stop按钮,而是注意到了操作ID, 如图13所示(在我的情况下,操作ID为20038 )。

    Figure 13 图13

    I then used this operation ID as an input parameter to the [catalog].[stop_operation] stored procedure as shown in Script 3.

    然后,我将此操作ID用作[catalog]。[stop_operation]存储过程的输入参数,如脚本3所示。

    
    USE SSISDB
    GOEXEC [catalog].[stop_operation] 20038

    Script 3

    脚本3

    After successfully executing Script 3, Figure 14 shows that another row has been added with a Canceled status. This confirms that stopping package execution using the Active Operations window is equivalent to executing the [catalog].[stop_operation] stored procedure.

    成功执行脚本3后图14显示已添加另一行,其状态为“已取消”。 这确认了使用“活动操作”窗口停止包执行等同于执行[catalog]。[stop_operation]存储过程。

    Figure 14 图14

    结论 (Conclusion)

    In this article we have demonstrated different ways to stop a runaway SSIS Package. It was demonstrated that the SQL Agent job history is a reliable source of information when the runaway package is terminated using SQL Agent and a Kill T-SQL command. Alternatively, Integrations Services Server becomes a reliable source for details relating to a package execution that is stopped using Active Operations window or the stop operation stored procedure.

    在本文中,我们演示了停止失控的SSIS程序包的不同方法。 事实证明,使用SQL Agent和Kill T-SQL命令终止失控包时,SQL Agent作业历史记录是可靠的信息来源。 或者,Integration Services服务器将成为与包执行有关的详细信息的可靠来源,该包执行使用“活动操作”窗口或停止操作存储过程来停止

    资料下载 (Downloads)

    • SSISDemoJob – Sleep.sql SSISDemoJob – Sleep.sql
    • SSISDemo SSIS演示

    参考 (Reference)

    • Thread.Sleep MethodThread.Sleep方法
    • catalog.stop_operation (SSISDB Database)catalog.stop_operation(SSISDB数据库)
    • Integration Services (SSIS) Server and Catalog集成服务(SSIS)服务器和目录

翻译自: https://www.sqlshack.com/stop-runaway-ssis-package/

ssis 包配置组织程序

ssis 包配置组织程序_如何停止失控的SSIS程序包相关推荐

  1. 11无监听程序_腾讯开心鼠英语 小程序实践与总结

    腾讯开心鼠英语 团队中有很多小程序的项目,且后续还会很多小程序的开发和迭代规划,因此我们团队是小程序的重度使用者.在小程序的开发中,团队积累了一些技术和经验,也遇到了一些困难和挑战,还踩了很多坑,因此 ...

  2. plsql developer无监听程序_腾讯开心鼠英语 小程序实践与总结

    腾讯开心鼠英语 团队中有很多小程序的项目,且后续还会很多小程序的开发和迭代规划,因此我们团队是小程序的重度使用者.在小程序的开发中,团队积累了一些技术和经验,也遇到了一些困难和挑战,还踩了很多坑,因此 ...

  3. idea导包都报错_不仅仅要会导别人的包也要会导自定义的包——Python导包总结...

    1 前言 导包这个词我相信编程人员不会陌生.如何很好地在Python中导入别人的包以及自己写的工具函数?这时需要分清楚和用好的,特此总结以飨读者. 2 优雅地导入别人的包 当然这里主要指你使用pip( ...

  4. 用uml设计java应用程序_用UML设计Java应用程序之需求分析

    本节向大家介绍一下如何用UML设计Java应用程序, 这里就以图书馆借阅和预定图书和杂志的应用程序为例向大家讲解,主要有需求分析和域分析等内容,相信本节的学习一定会让你对UML设计有新的理解. 用UM ...

  5. 关于fi dd ler 手机抓包 网卡地址地址_实测对比Wireshark利用nRF52832抓包和Packet Sniffer抓包体验...

    在蓝牙的开发过程中,使用抓包器对蓝牙模块收发数据进行抓包BLE分析,无疑会极大地提高我们的研发开发效率,同时能帮我们快速地定位问题.对于初学者或者开发者来说,BLE抓包分析能让我们更快地理解蓝牙的工作 ...

  6. java application程序_如何Java编写的application程序像exe一样方便shy;的运行

    Java编写的application程序是否能够最终形成一个类似于exe一样的可执行文件,难道就只能用命令行运行??? ---------------------------------------- ...

  7. 一个完整的嵌入式程序_放下偏见,原来嵌入式程序员如此“妖娆”!

    感兴趣的小伙伴可以来我的Java交流群,可以获取免费的学习资料 828 697 593 对Java技术,架构技术感兴趣的同学,欢迎加群,一起学习,相互讨论. 竟然都看到最后了,给小编点个关注吧,小编还 ...

  8. windows桌面应用程序_如何将Windows桌面应用程序转换为通用Windows应用程序

    windows桌面应用程序 With Windows 10's Anniversary Update, Microsoft is making it possible for developers t ...

  9. object picker 微信小程序_七夕地图导航微信小程序

    七夕期间,开发一款七夕微信小程序,地图导航是七夕小程序一种功能,今天单独开发一款纯七夕地图导航小程序,供大家娱乐,希望大家喜欢. 准备着手实现一个小程序,功能包括--获取用户当前位置的经纬度,在地图上 ...

最新文章

  1. #pragma once与 #ifndef的区别为了避免同一个文件被include多次
  2. HTML DOM知识点补充:
  3. linux可以http安装么,Linux 5下 http的安装
  4. spring cloud(九):各组件常用配置参数
  5. jdba访问mysql_mysql连接出现问题记录
  6. java 中加法递归_java 简单的加法 递归 从A加到B
  7. 从分布式环境的特点、问题到CAP、BASE理论详解
  8. 介绍 SQL Server 的安全配置
  9. Atitit.故障排除系列---php 程序网站数据库错误排除流程
  10. 【优化算法】供需优化算法(SDO)【含Matlab源码 1804期】
  11. 《区块链技术指南》电子书推荐!
  12. adb小天才_ADB工具包2020年最新版下载-支持解锁新机BL调试ROOT等各种操作
  13. CMYK、RGB颜色对照表
  14. Oracle中相同字段补充,oracle一次给多表添加相同字段
  15. html语言隔开的代码,2、HTML(示例代码)
  16. Java面向对象编程练习:定义一个交通工具的基类,包含成员属性商标和颜色,成员方法run和showInfo显示信息。编写小汽车类和卡车类来继承交通工具类,添加相应的方法显示各自的信息
  17. python pyinstaller使用方法_【python快手菜】pyinstaller使用指南
  18. 有没有谁做过完整的ptf上传下载
  19. 【GAMES101现代计算机图形学入门笔记】Lec05 光栅化1(三角形)
  20. SAP请求一键传输程序

热门文章

  1. 爬虫python可以干嘛_【Python爬虫】什么是爬虫,爬虫能做什么?
  2. 2019春第一课程设计报告
  3. python函数回顾:abs()
  4. HDU 5136 Yue Fei's Battle
  5. ArrayQueue详解(待解决)
  6. Win7系统解决JAVA或者APKtool不是内部或者外部命令
  7. CListCtrl 使用(转)
  8. [转]如何才能在 IIS 7.5 使用 Windows PowerShell Snap-In 功能
  9. LeetCode(404)——左叶子之和(JavaScript)
  10. 利用Navicat Premium将SQL Server数据库转为My SQL数据库(解决Mac无法打开SQL Server 脚本文件的方法)