java 执行ssis包

In the article, SQL Server CHECKPOINT, Lazy Writer, Eager Writer and Dirty Pages in SQL Server, we talked about the CHECKPOINT process for SQL Server databases. This article is about CHECKPOINT in SSIS package.

在SQL ServerSQL Server CHECKPOINT,惰性编写器,Eager Writer和脏页一文中 ,我们讨论了SQL Server数据库的CHECKPOINT流程。 本文是关于SSIS包中的CHECKPOINT的。

  • Note: Before reading this article, let me just tell you that CHECKPOINT in SSIS package and SQL Server CHECKPOINT are entirely different terms and are not related in any way. 注意:在阅读本文之前,让我只告诉您SSIS包中的CHECKPOINT和SQL Server CHECKPOINT是完全不同的术语,并且没有任何关系。

介绍 (Introduction)

Suppose we have an integration service package that does lots of data transformations and data insertion. The SSIS package fails, and you identify the error following the article Overview of SSIS Package Logging. You fix the error and rerun the package.

假设我们有一个集成服务包,它可以进行大量的数据转换和数据插入。 SSIS软件包失败,您可以在文章SSIS软件包日志概述下找到错误。 您修复该错误,然后重新运行该程序包。

Suppose we have 10 steps in the package and it failed after completing 7 steps. If we restart the package, it starts from step 1 and runs the whole package. Assume that overall package execution takes 5 hours to complete and out of which step 1 to 6 takes most of the time approx. 4 hours. Steps 7 to 10 only takes 1 hour. The package failed at step 7 that shows we have already executed it for approximately 4 hours and due to an error, we need to again wait for approximately 5 hours to finish it. It is a critical package, and we cannot afford such failures. In case of failure also, we want to restart the package from the point of failure.

假设程序包中有10个步骤,并且在完成7个步骤后失败了。 如果我们重新启动程序包,它将从步骤1开始并运行整个程序包。 假设整个程序包执行需要5个小时才能完成,而步骤1到6花费了大部分时间。 4个小时。 步骤7到10仅需1个小时。 程序包在步骤7失败,表明我们已经执行了大约4个小时,并且由于错误,我们需要再次等待大约5个小时才能完成。 这是至关重要的一揽子计划,我们无法承担这样的失败。 同样在发生故障的情况下,我们希望从故障点重新启动软件包。

Do you think we can restart SSIS package from the point of failure instead of running complete package?

您认为我们可以从故障的角度重新启动SSIS软件包,而不是运行完整的软件包吗?

The answer is yes, we can use SSIS CHECKPOINT to do this task for us. Let’s explore this term in the upcoming section.

答案是肯定的,我们可以使用SSIS CHECKPOINT为我们完成此任务。 让我们在接下来的部分中探讨这个术语。

SSIS包中的CHECKPOINT概述 (Overview of CHECKPOINT in SSIS package)

We can configure a CHECKPOINT file in the SSIS package to log package execution information in it. If the package execution fails, SSIS uses the information in the checkpoint file to restart it from the point of failure. Once the package successfully executes, it removes the checkpoint file. On the next package execution, it does not find the checkpoint file and starts the package execution from stretch and creates a new checkpoint file.

我们可以在SSIS包中配置CHECKPOINT文件,以在其中记录包执行信息。 如果程序包执行失败,SSIS将使用检查点文件中的信息从失败点重新启动它。 包成功执行后,它将删除检查点文件。 在下一次执行程序包时,它将找不到检查点文件,而是从stretch开始执行程序包并创建一个新的检查点文件。

We can use CHECKPOINT in the SSIS package to restart the failed package, but it works on the control flow level. We cannot configure a checkpoint to start the package at the data flow level.

我们可以在SSIS包中使用CHECKPOINT来重新启动失败的包,但是它可以在控制流级别上运行。 我们无法配置检查点以在数据流级别启动程序包。

  • Note: This article assumes you have a basic understanding of SSIS packages. If not, please go through SSIS articles on SQLShack.
  • 注意:本文假定您对SSIS包有基本的了解。 如果没有,请阅读有关SQLShack的SSIS文章。

I have an SSIS package for my test environment, and it contains the following tasks in the Control flow:

我有一个用于测试环境的SSIS程序包,它在控制流中包含以下任务:

  • Data Flow Task 数据流任务
  • Execute SQL task to update a few records 执行SQL任务以更新一些记录

The data flow task contains the following source to destination data transfer tasks.

数据流任务包含以下源到目标数据传输任务。

We have not done the configuration of CHECKPOINT in SSIS package. Let’s execute this package, and it should fail at Update Records task.

我们尚未在SSIS软件包中完成CHECKPOINT的配置。 让我们执行该程序包,它应该在“ 更新记录”任务时失败。

As expected, the SSIS package fails.

不出所料,SSIS包失败。

The data flow task is completed successfully, and you can view that 6 rows transferred from source to destination table.

数据流任务已成功完成,您可以查看从源表转移到目标表的6行。

Restart the SSIS package (press Ctrl+Shift+F5), and it starts the package again from the beginning. You get a similar output for this package once again. As the data flow task is executed again, we get duplicate data in the destination table.

重新启动SSIS程序包(按Ctrl + Shift + F5),它将从头开始重新启动程序包。 您将再次为此包获得类似的输出。 随着数据流任务再次执行,我们在目标表中获得了重复的数据。

We can avoid this situation using CHECKPOINT in SSIS package.

我们可以在SSIS包中使用CHECKPOINT来避免这种情况。

在SSIS中配置检查点 (Configuring Checkpoints in SSIS)

In the SSIS package, go to package properties using the menu bar (View -> Properties). You can also use the shortcut key F4 to open the following properties window.

在SSIS包中,使用菜单栏转到包属性(“视图”->“属性”)。 您也可以使用快捷键F4打开以下属性窗口。

In these properties, you can see a tab Checkpoints with following configurations:

在这些属性中,您可以看到带有以下配置的“检查点”选项卡:

  • CheckpointFileName: It is the file in which the SSIS package will log package execution information. You can click on it and browse to the destination path or paste the folder location along with file name in XML format. It should be a valid directory, and you can use a network UNC path as well, but the appropriate permissions should be set else you get an error message that the package could not access the checkpoint file CheckpointFileName :SSIS包将在其中记录包执行信息的文件。 您可以单击它并浏览到目标路径,或者将文件夹位置以及文件名粘贴为XML格式。 它应该是有效目录,并且您也可以使用网络UNC路径,但是应该设置适当的权限,否则会收到错误消息,指出程序包无法访问检查点文件
  • CheckpointUsage: It gives the following checkpoint file usage options CheckpointUsage :它提供以下检查点文件使用选项
    • Never: SSIS package will never use the checkpoint feature. It is the default option 从不 :SSIS程序包将永远不会使用检查点功能。 这是默认选项
    • IfExists: In this option, the SSIS package will read the information in the checkpoint file if it is already there. If not, it will skip this and restart the package. We should use this option in most cases IfExists :在此选项中,SSIS包将读取检查点文件中的信息(如果已存在)。 如果没有,它将跳过此步骤并重新启动软件包。 在大多数情况下,我们应该使用此选项
    • Always: We can configure the package to 始终:我们可以将包配置为Always use checkpoint information from the checkpoint file. If the information is not available, the SSIS package will throw an error message 始终使用检查点文件中的检查点信息。 如果该信息不可用,SSIS程序包将引发错误消息
  • SaveCheckpoints: We can choose to save the checkpoint information or not SaveCheckpoints:我们可以选择是否保存检查点信息

Let’s do the following CHECKPOINT in SSIS package configuration:

让我们在SSIS包配置中执行以下CHECKPOINT:

  • Checkpointusage – IfExists 检查点使用– IfExists
  • SaveCheckpoints: True 保存检查点:正确

Execute the package, and it will fail against, but we do not see the checkpoint file in the configured path. In the Execution Results tab, we get the following message.

执行该程序包,它将失败,但是在配置的路径中看不到检查点文件。 在执行结果选项卡中,我们收到以下消息。

  • Warning: This task or container has failed, but because FailPackageOnFailure property is FALSE, the package will continue. This warning is posted when the SaveCheckpoints property of the package is set to TRUE, and the task or container fails.
  • 警告:此任务或容器已失败,但是由于FailPackageOnFailure属性为FALSE,因此程序包将继续。 当程序包的SaveCheckpoints属性设置为TRUE,并且任务或容器失败时,将发布此警告。

We are also required to configure a property FailPackgaeOnFailure for all control flow tasks. Select the control flow tasks and change the value of FailPackgaeOnFailure to True.

我们还需要为所有控制流任务配置属性FailPackgaeOnFailure 。 选择控制流任务,并将FailPackgaeOnFailure的值更改为True。

Execute the package, and you can see a checkpoint file in the configured path. Open the file, and you can see the content of this file as follows.

执行该程序包,您可以在配置的路径中看到一个检查点文件。 打开文件,您可以看到该文件的内容,如下所示。

Fix the error message and rerun the package. It should only run the failed task. Package executes successfully, and you can note that it only executed the Update Records task. The data flow task was successful previously. Therefore, you do not see any status for the Data flow task because it is not executed this time.

修复错误消息,然后重新运行程序包。 它应该只运行失败的任务。 包成功执行,您可以注意到它仅执行了Update Records任务。 数据流任务先前已成功。 因此,您不会看到数据流任务的任何状态,因为这次没有执行。

Go back to the location of CHECKPOINT in SSIS package file, and you will not find the file. The SSIS package removes this file once the package execution completes successfully.

回到SSIS包文件中CHECKPOINT的位置,您将找不到该文件。 包执行成功完成后,SSIS包将删除此文件。

Let’s look at one more failure example. I modified my SSIS package to include the following in the data flow task. It includes two tasks for transferring data from source to destination tables.

让我们再看一个失败示例。 我修改了SSIS包,以将以下内容包括在数据流任务中。 它包括将数据从源表传输到目标表的两项任务。

I also modified the control flow task to execute the Update Record task first and then it should run the data flow task. You can see the following modified SSIS package.

我还修改了控制流任务以首先执行Update Record任务,然后它应该运行数据流任务。 您可以看到以下修改后的SSIS包。

Once we execute the package, it should fail one of the data flow tasks. We already have CHECKPOINT in SSIS package configuration for this package.

一旦执行了程序包,它将使数据流任务之一失败。 我们已经在此包的SSIS包配置中拥有CHECKPOINT。

Double-click on this data flow task, and it shows the second task as failed.

双击此数据流任务,它将第二个任务显示为失败。

You can also see a checkpoint file, and it has the following contents in it.

您还可以看到一个检查点文件,其中包含以下内容。

In the Progress bar, we also see information about the checkpoint file.

在进度栏中,我们还会看到有关检查点文件的信息。

Fix the error and execute the package again. Before the execution, what do you think will happend?

解决错误,然后再次执行程序包。 在执行之前,您认为会发生什么?

Will the package execute only the failed task in the data flow task, or will it execute both tasks inside the data flow task?

程序包将只执行数据流任务中失败的任务,还是只执行数据流任务中的两个任务?

As specified previously, CHECKPOINT in SSIS package works on the control flow level. We cannot configure it to execute the individual task at the data flow level.

如前所述,SSIS包中的CHECKPOINT在控制流级别上起作用。 我们无法将其配置为在数据流级别执行单个任务。

Let’s execute the package and note the behaviors in the package.

让我们执行该程序包并注意该程序包中的行为。

  • It does not execute the Update Records task because this task was executed successfully in the previous run. SSIS gets this information from the CHECKPOINT file and skips this part

    它不执行更新记录任务,因为此任务在上一次运行中已成功执行。 SSIS从CHECKPOINT文件中获取此信息,并跳过这一部分

  • Data flow task is successful, but if we open the task details, we can see it executed both tasks. It does not skip task 1 that was successful in previous runs. It validates the above point that we cannot configure checkpoint at the data flow level. It works only at control flow task level

    数据流任务已成功完成,但是如果我们打开任务详细信息,则可以看到它执行了两个任务。 它不会跳过在先前运行中成功完成的任务1。 它验证了以上几点,我们无法在数据流级别配置检查点。 它仅在控制流任务级别起作用

  • Open the progress bar, and in there you can see an information message that the package restarted from the checkpoint file. The package was configured to restart from the checkpoint

    打开进度条,然后在其中可以看到一条信息消息,说明软件包已从检查点文件重新启动。 程序包已配置为从检查点重新启动

  • 结论 (Conclusion)

    In this article, we explored the CHECKPOINT in the SSIS package and its usage to restart packages from the point of failure. It is an important feature especially for the large and involved packages that involve multiple steps, downloading files from locations such as SFTP. We can easily configure the package to use this feature. I would recommend to go through the steps and configure it for your environment.

    在本文中,我们探讨了SSIS程序包中的CHECKPOINT及其从故障点重新启动程序包的用法。 这是一项重要功能,特别是对于涉及多个步骤的大型且涉及大量的程序包,这些程序包从SFTP等位置下载文件。 我们可以轻松配置软件包以使用此功能。 我建议按照步骤进行操作,并根据您的环境进行配置。

翻译自: https://www.sqlshack.com/using-checkpoint-in-ssis-package-to-restart-package-execution/

java 执行ssis包

java 执行ssis包_在SSIS包中使用CHECKPOINT重新启动包执行相关推荐

  1. 查看python包_怎么查看python中已安装的包

    展开全部 使用命令 pip list 可以查看2113python中已安装的包5261:具体步骤如下: 1.打开4102python:在命令符模式下(运1653行→cmd)输入Python回车即可 2 ...

  2. python构造icmp数据包_如何在python中构造ICMP数据包

    为了学习,我目前正在尝试创建一个简单的python porgram来向某个设备发送ICMP ping数据包.为了开始,我查看了python模块Pyping:https://github.com/Akh ...

  3. python解析http数据包_如何在python中嗅探HTTP数据包?

    I want to sniff all the HTTP packets in my computer via python(version2.6.. is this possible? can I ...

  4. idea如何打开pom引用依赖_IDEA使用Maven管理项目包,缺少pom文件中引入的依赖包...

    1. 说在前面 最近和其他项目团队合作过程中,由于使用 idea 进行开发,之前也没有接触过太多,本着记录分享的心态,虽有此文.主要说两点:第一,使用 maven 构建项目的过程中,在 pom 文件引 ...

  5. java 扰码工具_【Developer Log】ProGuard扰码可执行JAR包

    在项目上线之前需要通过ProGuard来对java的class进行混淆,以避免反编译方式,来保护自己的代码.ProGuard网上有很多资料,可以参考:http://blog.csdn.net/zhan ...

  6. java秃头表情包_最怕空气突然的安静表情包 - 最怕空气突然的安静微信表情包 - 最怕空气突然的安静QQ表情包 - 发表情 fabiaoqing.com...

    最怕空气突然安静最怕大乔突然关心_最怕_大乔_突然_安静_关心表情 突然登场 - 最怕空气突然的安静 ​_突然表情 突然抱紧 - 最怕空气突然的安静 ​_突然表情 突然兴奋 - 最怕空气突然的安静 ​ ...

  7. ssis组件_使用SSIS Hadoop组件连接到Apache Hive和Apache Pig

    ssis组件 In our previously published articles in this series, we talked about many SSIS Hadoop compone ...

  8. ssis组件_用于SSIS的Melissa Data Quality免费组件

    ssis组件 In this article, we will talk briefly about data quality in SQL Server. Then, we will give a ...

  9. java执行sql文件_面试官问你MyBatis SQL是如何执行的?把这篇文章甩给他

    初识 MyBatis MyBatis 是第一个支持自定义 SQL.存储过程和高级映射的类持久框架.MyBatis 消除了大部分 JDBC 的样板代码.手动设置参数以及检索结果.MyBatis 能够支持 ...

最新文章

  1. mysql 表结构关系_mysql 表关系 与 修改表结构
  2. SAP更新数据表的程序执行需要SE38后执行
  3. 数据仓库—stg层_手把手教你创建BI数据仓库STG层
  4. 教你3行代码坑崩系统(哈哈哈哈)
  5. Redhat Linux编译安装LAMP环境
  6. 自己写的 ORACLE 函数的解读
  7. OSI七层网络模型与TCP/IP四层网络模型
  8. PHP中的pack和unpack函数
  9. java 复印件效果_简历复印—原型模式
  10. 算法习题---线性表之数组实现循环移动
  11. PySlowFast 视频理解代码库
  12. 影视剪辑,零基础如何自学入门剪辑,视频剪辑入门规划
  13. C# 利用 OleDb 组件操作 Excel 进行文件读写操作
  14. 编译原理LL(1)文法-判断,first,follow,select,分析字符串
  15. Java自定义连接池
  16. Java版1-50内素数(质数)和
  17. 计算机英语 译文,计算机英语参考译文
  18. Task02——支持向量机(Support Vector Machine,SVM)
  19. 《程序员》专访:对话张宏江
  20. you-get安装 使用与介绍

热门文章

  1. jquery--动态篇
  2. mongo 修改器 $inc/$set/$unset/$pop/$push/$pull/$addToSet
  3. 让我们一起Go(二)
  4. sql server sysobjects 中type 和xtype
  5. 如何判断一个变量是数组还是对象
  6. LeetCode(181)——超过经理收入的员工(MySQL)
  7. 六级词汇打卡第天四天(四)
  8. properties 配置回车_PTB220/330 | 长春气象仪器所自动站配置
  9. 作为餐饮店长最需要什么能力?
  10. “云手机”是否会成为未来的主流?