SSIS包作业执行完成后如何查看结果?
我有一个 SSIS 包,它将数据导入 SQL Server 2008 数据库。我已经在 SQL Server 代理中设置了计划作业来运行该包。当我查看历史记录时,我只能看到作业是否运行成功。除此之外我看不到其他消息。
我想知道每当执行作业时会导入多少条记录。我怎样才能监控它?我应该使用 SSIS 包中的附加组件还是在 SQL Server 代理作业设置中设置一些配置?
我在 SQL Server 代理作业设置中找到了一些日志记录工具,但我不确定它是否可以满足我的要求。
I have an SSIS package which imports the data into the SQL Server 2008 database. I have set up the schedule job in the SQL Server Agent to run that package. When I check the history, I could only see whether the job ran successfully or not. I could not see other messages apart from that.
I would like to know how many records are imported whenever the job is executed. How can I monitor that? Should I use the additional components in SSIS package or set some configurations in SQL Server Agent Job Setup?
I found some logging facilities in SQL Server Agent Job Setup but I am not sure it can fulfill my requirements or not.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您已将该包部署到数据库的集成服务目录(而不是从文件系统加载它),您可以轻松获得详细的报告。
在 SQL Server Management Studio 中打开目录节点,右键单击包名称,选择“报表”|“报表”。标准报告|所有执行并查看有关作业及其子组件的每个步骤的详细信息,包括导入的记录。
If you have deployed the package to the database's Integration Services Catalog (rather than load it from a file system) you can easily get detailed reporting.
Open the catalog node in SQL Server Management Studio, right click the Package name, select Reports | Standard Reports | All Executions and see details about every step of the job and its subcomponents, including records imported.
当 SQL Server 作业历史记录不显示 SSIS 包的输出时,还有另一种方法:使用 DTEXEC 命令行。
(好处:这种方法将作业的输出放在支持它的其他人期望找到的地方:在作业历史记录中。
大包的缺点:如果你有一个很长的SSIS包,有很多任务或组件,还有很多输出,那么作业历史记录会将包输出分成很多行作业历史记录,从而采用前面答案中的方法——日志记录到表中——更易于阅读。)
要在作业的查看历史记录中显示 SSIS 包输出:
(1) 将作业步骤从类型“SQL Server Integration Services Package”更改为“操作系统 (CmdExec)”,
(2) 使用DTEXEC命令行,执行包。
命令行示例:
请注意,如果 SSIS 包需要 32 位 执行(例如,导出到 Excel 时为 true),则通过完全限定来使用“Program Files (x86)”中的 DTEXEC 实用程序它。例如,SQL Server 应用程序安装在“E:”驱动器上,并且使用 SQL Server 2014:
如果您的 SSIS 包位于文件系统中(作为“.dtsx”文件),则替换“/DTS”与“/文件”。
如果您的 SSIS 包放置在 SSISDB 中(使用从 SQL Server 2012 开始提供的“项目部署模型”,而不是旧的“包部署模型”),则将“/DTS”替换为“/ISSERVER”。
接下来,进入作业步骤的“高级”页面,并确保选中“在历史记录中包含步骤输出”框。
最后,考虑您的作业步骤的“运行方式”:如果您的作业步骤“运行方式”已设置为“SQL Server Integration Services Package”类型的作业步骤上的代理,则您已将该代理设置为对子系统有效SQL Server 集成服务包”。现在,要执行上述命令行,请检查代理的属性,并确保它对于子系统“操作系统 (CmdExec)”也处于活动状态。
MSDN 参考:Sql 代理历史记录上的 SSIS 输出
Here's another approach for when SQL Server job history is not showing output from SSIS packages: use DTEXEC command lines.
(Upside: this approach puts the job's output where anyone else supporting it would expect to find it: in job history.
Downside for big packages: if you have a long SSIS package, with lots of tasks or components, and lots of output, then the job history will split package output into many lines of job history, making the approach in the previous answer--logging to a table--easier to read.)
To show SSIS package output in the job's View History:
(1) Change the job steps from type "SQL Server Integration Services Package", to "Operating system (CmdExec)",
(2) Use DTEXEC command lines, to execute the packages.
Example of command line:
Note that if the SSIS package requires 32-BIT execution (true for exporting to Excel, for example), then use the DTEXEC utility in "Program Files (x86)" by fully qualifying it. Example, where the SQL Server application was installed on an "E:" drive, and where SQL Server 2014 is being used:
If your SSIS packages are in the file system (as ".dtsx" files), then replace "/DTS" with "/FILE".
If your SSIS packages were placed in SSISDB (using the "project deployment model", which is available starting with SQL Server 2012, instead of the older "package deployment model"), then replace "/DTS" with "/ISSERVER".
Next, go into the job step's "Advanced" page, and make sure that the box is checked for "Include step output in history".
Lastly, consider your job step's "Run as": if your job steps "Run as" were already set to a proxy, on job steps of type "SQL Server Integration Services Package", then you already made that proxy active to the subsystem "SQL Server Integration Services Package". Now, to do command lines like the above, check the proxy's properties, and make sure it is also active to the subsystem "Operating system (CmdExec)".
MSDN reference: SSIS Output on Sql Agent history
使用以下过程获取带有执行 ID 的 SSIS 错误
use the below procedure for getting SSIS errors with execution id
如果您只是想了解正在处理的列,而对进一步使用的信息不感兴趣,一种可能的选择是使用 SSIS 日志记录功能。以下是它如何用于数据流任务。
希望有帮助。
屏幕截图 #1:
屏幕截图 #2:
屏幕截图#3:
屏幕截图 #4:
If you are just interested in knowing the columns being processed and not interested with the info for further use, one possible option is making use of the SSIS logging feature. Here is how it works for data flow tasks.
Hope that helps.
Screenshot #1:
Screenshot #2:
Screenshot #3:
Screenshot #4: