查看ssis执行日志

This article gives an overview of the different methods of SQL Server SSIS Package Logging.

本文概述了SQL Server SSIS包日志记录的不同方法。

介绍 (Introduction)

Event logs are essential for database administrators. It helps us to troubleshoot the issues or get an insight into running processes. We also require performing Root Cause Analysis for any critical issues. We use SQL Server Integration Services for deploying ETL packages. These ETL packages help for data load, automation various tasks in SQL Server.

事件日志对于数据库管理员来说至关重要。 它可以帮助我们解决问题或深入了解正在运行的流程。 我们还要求对任何关键问题执行根本原因分析。 我们使用SQL Server集成服务来部署ETL包。 这些ETL软件包有助于数据加载,自动化SQL Server中的各种任务。

Usually, we deploy the SSIS packages using a SQL Agent job and configure it to run as per the defined schedule. Once the SSIS package fails in the SSDT or BIDS, we can check the progress tab to look into the detailed error message. It is not an easy task to identify the error message if the package is running using a SQL Agent Job.

通常,我们使用SQL Agent作业部署SSIS包,并将其配置为按照定义的时间表运行。 一旦SSDT或BIDS中的SSIS包失败,我们可以检查“进度”选项卡以查看详细的错误消息。 如果程序包正在使用SQL Agent Job运行,要识别错误消息并不是一件容易的事。

SSIS包记录的不同方法 (Different methods of SSIS Package Logging)

We can use the following SSIS Logging methods for troubleshooting purposes.

我们可以使用以下SSIS日志记录方法进行故障排除。

  • SSIS packages log providers SSIS包日志提供程序
  • Custom Logging messages using scripts in the Execute SQL Task 使用执行SQL任务中的脚本的自定义日志消息
  • In the project deployment model from SQL Server 2012, the SSIS catalog provides the execution logs in the SSISDB database 在SQL Server 2012的项目部署模型中,SSIS目录在SSISDB数据库中提供执行日志

In this article, we will explore the SSIS package log providers.

在本文中,我们将探讨SSIS包日志提供程序。

SSIS包日志提供程序 (The SSIS package log providers)

For the demonstration, let’s create a SSIS package to execute the SQL Script. In the SQL Server Data Tools, create a new project for integration services. I added a new SSIS package to an existing project.

为了演示,让我们创建一个SSIS包来执行SQL脚本。 在SQL Server数据工具中,为集成服务创建一个新项目。 我向现有项目添加了新的SSIS包。

Configure a demo project

配置演示项目

Drag an Execute SQL Task in the Control Flow.

在控制流中拖动一个执行SQL任务。

We require configuring the Execute SQL Task. Double-click on this task to open the Execute SQL Task editor.

我们需要配置执行SQL任务。 双击此任务以打开“执行SQL任务”编辑器。

Click on the drop-down in the Connection and go to New Connection. It also shows the existing connections to use. Let’s use this connection in this article. If you want to create a new connection, you can provide the required details such as SQL Instance name, database name, and authentication in the connection window.

单击“连接”中的下拉菜单,然后转到“新建连接”。 它还显示了要使用的现有连接。 让我们在本文中使用此连接。 如果要创建新连接,则可以在连接窗口中提供所需的详细信息,例如SQL实例名称,数据库名称和身份验证。

In the SQL Statement, specify the script you want to execute.

在SQL语句中,指定要执行的脚本。

Click Ok and configuration is now completed for the Execute SQL Task.

单击“确定”,现在就完成了“执行SQL任务”的配置。

In the Solution Explorer, Right-click on the SSIS package and click on Execute.

在解决方案资源管理器中,右键单击SSIS包,然后单击“执行”。

The Red-Cross icon on the execute SQL Task shows that the package execution failed.

执行SQL任务上的红叉图标显示包执行失败。

Click on the Progress tab for the detailed error message. By looking at the following screenshot, we can identify the error message.

单击“进度”选项卡,以获取详细的错误消息。 通过查看以下屏幕截图,我们可以识别错误消息。

We want a similar kind of error message every time the package executes in SQL Agent job as well. We need to configure the SSIS Logging.

每当程序包在SQL Agent作业中执行时,我们也希望收到类似的错误消息。 我们需要配置SSIS日志记录。

配置SSIS包日志记录 (Configure an SSIS package logging)

Let’s configure SSIS Logging in this package.

让我们在此程序包中配置SSIS日志记录。

Right-click on the control flow area, and it gives you a list of options.

右键单击控制流区域,它会为您提供选项列表。

Click on Logging, and it opens Configure SSIS Logs window.

单击日志记录,它将打开“配置SSIS日志”窗口。

In the bottom message bar, it gives a message ‘to configure unique logging options, we need to enable logging for it in the tree view’.

在底部的消息栏中,它显示一条消息“配置唯一的日志记录选项,我们需要在树形视图中启用它的日志记录”。

Put a tick in the project checkbox and it enables the logging for this SSIS package.

在项目复选框中打勾,它将启用此SSIS包的日志记录。

On the right-hand side, we can see two tabs for configuration.

在右侧,我们可以看到两个用于配置的标签。

SSIS包日志中的提供程序和日志 (Provider and Logs in the SSIS package logging)

In this tab, we select the SSIS logging provider type and their configurations.

在此选项卡中,我们选择SSIS日志记录提供程序类型及其配置。

We have following SSIS log providers available here.

我们在这里有以下SSIS日志提供程序。

  • SSIS log provider for Text files: We use this log provider to store information in a TXT or CSV format. Usually, developers use this format to store logs information 文本文件的SSIS日志提供程序:我们使用此日志提供程序以TXT或CSV格式存储信息。 通常,开发人员使用此格式存储日志信息
  • SSIS log provider for SQL Server: We can store the SSIS logs in the database tables. It makes it easy to query the logs using the t-SQL queries SQL Server的SSIS日志提供程序:我们可以将SSIS日志存储在数据库表中。 使用t-SQL查询可以轻松查询日志
  • SSIS log provider for Windows Event log: We can use this log provider to send information in the application event viewer. The source name for these events is SQLISPackage110. We do not require any separate configuration to use this provider Windows事件日志的SSIS日志提供程序:我们可以使用此日志提供程序在应用程序事件查看器中发送信息。 这些事件的源名称是SQLISPackage110。 我们不需要任何单独的配置即可使用此提供程序
  • SSIS log provider for SQL Server Profiler: DBA usually use SQL Profiler to log queries and investigate issues in SQL Server. We can use this log provider to produce a SQL profiler trace. We can specify a .trc extension to open it with SQL profiler and view the package execution systematically SQL Server Profiler的SSIS日志提供程序: DBA通常使用SQL Profiler记录查询并调查SQL Server中的问题。 我们可以使用此日志提供程序来生成SQL事件探查器跟踪。 我们可以指定一个.trc扩展名,以使用SQL事件探查器将其打开,并系统地查看包的执行情况
  • SSIS log provider for XML files: This log provider stores the package logs in the XML files. We can configure the XML files and open the logs in tools such as browser, notepad or Visual Studio XML文件的SSIS日志提供程序:此日志提供程序将程序包日志存储在XML文件中。 我们可以配置XML文件并打开浏览器,记事本或Visual Studio等工具中的日志

SSIS包日志中的“详细信息”部分 (Details section in the SSIS package logging)

This section allows us to configure the events that we want to capture in the logs.

本部分允许我们配置要在日志中捕获的事件。

Let’s take a short overview of these events.

让我们简要概述一下这些事件。

  • OnError: It logs an entry in the logs, in case of any error OnError:如果出现任何错误,它将在日志中记录一个条目
  • OnExecStatusChanged: If the status of a task changes to resumed or suspended, it logs an event in the error log OnExecStatusChanged:如果任务的状态更改为恢复或挂起,则它将事件记录在错误日志中
  • OnInformation: It writes the informational messages such as validation and execution of the task OnInformation:它写入信息性消息,例如任务的验证和执行
  • OnPostExecute: It handles the post-execution events. We can also execute the post package execution task in this OnPostExecute:处理后执行事件。 我们还可以在此执行打包后执行任务
  • OnPostValidate: once the task validation finishes, it writes an entry in the logs OnPostValidate:任务验证完成后,它将在日志中写入一个条目
  • OnPreExecute: Before the execution of a task, it logs an entry in the SSIS logs. You can also use this to configure the pre-execution task in a package such as truncating tables OnPreExecute:在执行任务之前,它将在SSIS日志中记录一个条目。 您还可以使用它来配置包中的预执行任务,例如截断表
  • OnPreValidate: Before a task validation starts, it writes an entry in the logs OnPreValidate:在任务验证开始之前,它将在日志中写入一个条目
  • OnProgress: It writes the progress of tasks such as percent execution in the event logs OnProgress:它将事件的进度(例如执行百分比)写入事件日志中
  • OnQueryCancel: It handles the query cancel events and writes in the event logs OnQueryCancel:处理查询取消事件并将其写入事件日志
  • OnTaskFailed: In case of any task failure in the SSIS package, it writes an entry in the SSIS log OnTaskFailed:如果SSIS包中的任何任务失败,它将在SSIS日志中写入一个条目
  • OnVariableValueChanged: if the value of variable changes inside the package, it writes an entry in package logs OnVariableValueChanged:如果变量的值在程序包内部发生更改,它将在程序包日志中写入一个条目
  • OnWarning: If the package execution raises a warning message, it logs an entry OnWarning:如果程序包执行引发警告消息,它将记录一个条目
  • Diagnostic: It writes an entry to provide diagnostic information for the SSIS package 诊断:它写入一个条目以提供SSIS包的诊断信息
  • DiagnosticEx: It provides additional information from the Diagnostic event to troubleshoot issues further DiagnosticEx:它提供了Diagnostic事件中的其他信息,以进一步解决问题

Click on the Advanced tab on the bottom page of the details page.

单击详细信息页面底部的高级选项卡。

You get an additional option, and it allows you to select the additional columns to capture in the SSIS logs.

您将获得一个附加选项,它允许您选择要在SSIS日志中捕获的附加列。

用于SSIS包日志记录的文本文件的SSIS日志提供程序 (The SSIS log provider for Text files for SSIS package logging)

Let’s configure the SSIS package for the OnError event and text file using the SSIS log provider for Text files:

让我们使用文本文件的SSIS日志提供程序为 OnError事件和文本文件配置SSIS包

Select SSIS Log provider for Text Files from the drop-down and click on Add.

从下拉列表中选择“ SSIS日志文件提供程序” ,然后单击“添加”。

In the Configuration column (number 3), click on New Connection.

在“配置”列(编号3)中,单击“新建连接”。

In the File Connection Manager Editor, specify the file and usage type as Create File. If you have an existing file, you can use usage type as an Existing file.

在“文件连接管理器”编辑器中,将文件和使用类型指定为“创建文件”。 如果您已有文件,则可以将使用类型用作现有文件

Click Ok, and you can see the file name in the configuration column.

单击确定,您可以在配置列中看到文件名。

Put a tick in the checkbox near to the Name column and go to details.

在“名称”列附近的复选框中打勾,然后转到详细信息。

We want to capture only the error events in the SSIS logs, therefore, select the OnError event message.

我们只想捕获SSIS日志中的错误事件,因此,选择OnError事件消息。

Click Ok and Execute the SSIS package. The package is failed again with the same error message.

单击确定,然后执行SSIS包。 程序包再次失败,并显示相同的错误消息。

Let’s go to the path in which we created the SSIS log flat-file and open SSISEventlog.txt file.

让我们转到创建SSIS日志平面文件并打开SSISEventlog.txt文件的路径。

SSIS包日志中用于SQL Server的SSIS日志提供程序 (The SSIS log provider for SQL Server in SSIS Package logging)

We can configure multiple SSIS log providers in the same package. Let’s add a provider to log information in the SQL tables.

我们可以在同一程序包中配置多个SSIS日志提供程序。 让我们添加一个提供程序以在SQL表中记录信息。

Right-click on the control flow area and go to logging again. Select SSIS Log Provider for SQL Server from the drop-down list and click Add. You can use an existing SSIS package connection or use a new connection for SQL Server. Let’s use the existing connection only.

右键单击控制流区域,然后再次进入日志记录。 从下拉列表中选择“ SQL Server的SSIS日志提供程序”,然后单击“添加”。 您可以使用现有的SSIS程序包连接或对SQL Server使用新的连接。 让我们只使用现有的连接。

In SQL Server logs also, we want to capture the error only. Click on the details and verify that event logging is set to OnError.

同样在SQL Server日志中,我们只想捕获错误。 单击详细信息,并验证事件日志记录设置为OnError。

Rerun the SSIS package. You can view the error message in both the flat file destination and the SQL Server database.

重新运行SSIS程序包。 您可以在平面文件目标位置和SQL Server数据库中查看错误消息。

You can find the dbo.sysssislog table in the system tables of the database that you have configured for the SSIS package logging.

您可以在为SSIS包日志记录配置的数据库的系统表中找到dbo.sysssislog表。

Execute the following query to select records from this table.

执行以下查询以从该表中选择记录。

SELECT *FROM [AutoGrowthTest].[dbo].[sysssislog]

You get four rows in the output corresponding with the following events.

您在输出中获得与以下事件对应的四行。

  • PackageStart PackageStart
  • OnError OnError
  • PackageEnd 包装结束

用于SSIS包日志记录的XML文件的SSIS日志提供程序 (The SSIS log provider for XML files for SSIS package logging)

XML is also a popular method to store the SSIS logs. Let’s configure XML files using the SSIS log provider for XML files and specify the file name and path in the configuration column.

XML也是一种存储SSIS日志的流行方法。 让我们使用SSIS日志提供程序为XML文件配置XML文件,并在配置列中指定文件名和路径。

In the Details page, let’s capture more details by selecting OnError, OnInformation and onProgress messages.

在“详细信息”页面中,让我们通过选择OnError,OnInformation和onProgress消息来捕获更多详细信息。

Rerun the package and open the XML file in a browser to view the SSIS logs. You can see detailed information in the SSIS logs.

重新运行该程序包,然后在浏览器中打开XML文件以查看SSIS日志。 您可以在SSIS日志中查看详细信息。

We do not see other events in this XML logs because the SSIS package did not execute any other tasks or made progress.

由于SSIS包未执行任何其他任务或未取得进展,因此在此XML日志中看不到其他事件。

在SSIS包日志中捕获其他详细信息 (Capture additional details in the SSIS package logging)

Let’s open the SSIS package configured in the article SSIS Conditional Split Transformation overview and configure the SSIS logs in an XML format and for the events OnError, OnInformation and onProgress messages.

让我们打开在SSIS 条件拆分转换概述一文中配置的SSIS包,并以XML格式配置SSIS日志,并配置事件OnError,OnInformation和onProgress消息。

The SSIS Package is successful this time. It should not capture the error details however additional details must be there in the log files.

这次的SSIS包成功了。 它不应捕获错误详细信息,但是其他详细信息必须在日志文件中。

Let’s view the output captured in the XML log file.

让我们查看XML日志文件中捕获的输出。

We can see additional information captured in the logs this time. It validates each task and logs entry for that.

这次我们可以在日志中看到捕获的其他信息。 它验证每个任务并为此记录日志。

Entry for the preparation of the executing phase in the SSIS logs.

SSIS日志中用于准备执行阶段的条目。

The Final Commit of the data process is also logged in the SSIS logs.

数据过程的最终提交也记录在SSIS日志中。

You can see Post Execute events, clean up phase and End of execution events as well in the SSIS events.

您可以在SSIS事件中看到“执行后事件”,“清理阶段”和“执行结束”事件。

结论 (Conclusion)

In this article, we explored the SSIS package logging to capture the useful information, key events, failure messages in the SSIS package execution for multiple provider locations such as flat files, XML files, SQL Server, event viewer, profiler trace. It is a good practice to configure the SSIS logging for package execution. Stay tuned to understand other methods for logging in my upcoming article.

在本文中,我们探索了SSIS包日志记录,以捕获SSIS包执行中有用的信息,关键事件,失败消息,这些信息针对多个提供程序位置,例如平面文件,XML文件,SQL Server,事件查看器,事件探查器跟踪。 好的做法是配置SSIS日志记录以执行程序包。 请继续关注以了解其他登录我即将发表的文章的方法。

翻译自: https://www.sqlshack.com/overview-of-ssis-package-logging/

查看ssis执行日志

查看ssis执行日志_SSIS包日志记录概述相关推荐

  1. ssis 列转换_SSIS包中的行采样转换和百分比采样转换

    ssis 列转换 This article explores Row Sampling Transformations in SSIS and Percentage Sampling Transfor ...

  2. ssis 列转换_SSIS组播转换概述

    ssis 列转换 This article explores the SSIS Multicast Transformation for creating different logical copi ...

  3. 如何在 ETL 项目中统一管理上百个 SSIS 包的日志和包配置框架

    一直准备写这么一篇有关 SSIS 日志系统的文章,但是发现很难一次写的很完整.因为这篇文章的内容可扩展的性太强,每多扩展一部分就意味着需要更多代码,示例和理论支撑.因此,我选择我觉得比较通用的 LOG ...

  4. 实例学习SSIS(四)--使用日志记录和错误流重定向

    原文:实例学习SSIS(四)--使用日志记录和错误流重定向 导读: 实例学习SSIS(一)--制作一个简单的ETL包 实例学习SSIS(二)--使用迭代 实例学习SSIS(三)--使用包配置 实例学习 ...

  5. 使用日志审计查看MaxCompute执行过哪些操作

    简介: MaxCompute完整地记录用户的各项操作行为,会自动将操作日志实时投递到ActionTrail中,ActionTrail针对作业(Instance).表(Table).函数(Functio ...

  6. linux记录用户命令的日志是,用日志记录Linux用户执行的每一条命令

    用日志记录Linux用户执行的每一条命令 用日志记录Linux用户执行的每一条命令 工作中,需要把用户执行的每一个命令都记录下来,并发送到日志服务器的需求,为此我做了一个简单的解决方案.这个方案会在每 ...

  7. ssis 包_SSIS包中的错误处理概述

    ssis 包 This article explains the process of configuring Error handling in SSIS package. 本文介绍了在SSIS程序 ...

  8. 如何使用SpringBoot AOP 记录操作日志、异常日志?

    点击上方蓝色"方志朋",选择"设为星标" 回复"666"获取独家整理的学习资料! 作者:咫尺的梦想_w cnblogs.com/wm-dv/ ...

  9. oracle查看联机日志,oracle联机日志和归档日志

    联机日志文件又叫重做日志文件,记录了对数据库修改的信息,包括用户对数据修改和数据库管理员对数据库结构的修改,一个oracle实例有一组或多组联机日志,每组至少包含1个或者多个日志成员,这里要多个日志成 ...

最新文章

  1. 深度信念网络研究现状与展望
  2. 电子管计算机的操作者是谁,大一计算机第一学期考试重点及相应习题 作者
  3. mysql可以使用dataguard_逻辑DataGuard的配置
  4. 报错,o.h.engine.jdbc.spi.SqlExceptionHelper   : Unknown column ‘template_name‘ in ‘field list‘
  5. 吴恩达深度学习(一)-第三周:Planar data classification with one hidden layer
  6. python中wx_python中wx模块的具体使用方法
  7. sendto()函数
  8. ubuntu中非常好用的PDF软件—okular
  9. 计算机辅助模具设计实训心得6,模具设计实训心得体会3篇
  10. linux测速脚本,七兮网络-Linux一键测速脚本Superspeed.sh,包含更多国内国际测速节点的脚本...
  11. u盘为什么要安全弹出?丢失的数据怎么恢复?
  12. 2015—2016年QS世界大学排名200强-[转]
  13. 解决使用百度地图API时偏移问题并自适应中心点和比例
  14. 管壳式程序c语言,换热器模型原程序(C语言).doc
  15. C语言-链表逆序输出
  16. ETSI开源MANO发布首个版本
  17. javaweb失物招领网站源码
  18. 二维数组求周长的问题
  19. element upload组件 onError神坑记录
  20. centOS7重启网卡失败

热门文章

  1. mybatis按datetime条件查询,参数为时间戳时
  2. 前端知识整理 CSS盒模型
  3. msp430项目编程44
  4. MySQL 批量添加
  5. 云计算学习(5-1)云平台产品介绍-华为的FusionCloud产品
  6. 获取屏幕,浏览器,网页高度宽度
  7. 上楼梯算法的java实现(转)
  8. JavaScript学习(九十一)—二维数组的基本操作
  9. 我喜欢现在的工作环境不错工资待遇一般
  10. 一亿人民币是什么概念?