繁体   English   中英

如何在使用DTEXEC.EXE命令行实用工具时获取SSIS包的实际执行时间

[英]How to get actual execution time of SSIS package while using DTEXEC.EXE Command Line Utility

我正在使用DTEXEC.EXE执行一个SSIS包,如下所示

C:\\ Program Files \\ Microsoft SQL Server \\ 140 \\ DTS \\ Binn> DTExec.exe / Server本地主机/ ISServer“ \\ MyServer \\ mypackage.dtsx”

执行命令后,它显示在下面的详细信息中。

Started:  3:28:09 PM
Execution ID: 41165.
To view the details for the execution, right-click on the Integration Services Catalog, and open the [All Executions] report
Started:  3:28:09 PM
Finished: 3:28:09 PM
Elapsed:  0.172 seconds

软件包的实际执行时间为20分钟,但“经过的时间显示为0.172秒。 使用命令行运行程序包时,是否有任何选项可以获取实际的执行时间?

提前致谢

当您从DTEXEC运行SSIS程序包时,它们将在同步执行模式下运行。 除非否则您要求它们从SSISDB运行。 然后,您需要向/Par "$ServerOption::SYNCHRONIZED(Boolean)";True DTEXEC调用中添加一个附加参数/Par "$ServerOption::SYNCHRONIZED(Boolean)";True

我创建了一个明显的等待延迟为15秒的程序包,并在我的机器上运行了两次。

C:\Users\billinkc>dtexec /server .\dev2017 /ISServer "\ssisdb\So\JustWait\Package.dtsx"
Microsoft (R) SQL Server Execute Package Utility
Version 14.0.3037.1 for 32-bit
Copyright (C) 2017 Microsoft. All rights reserved.

Started:  7:41:06 AM
Execution ID: 161421.
To view the details for the execution, right-click on the Integration Services Catalog, and open the [All Executions] report
Started:  7:41:06 AM
Finished: 7:41:07 AM
Elapsed:  0.141 seconds

C:\Users\billinkc>dtexec /server .\dev2017 /ISServer "\ssisdb\So\JustWait\Package.dtsx" /Par "$ServerOption::SYNCHRONIZED(Boolean)";True
Microsoft (R) SQL Server Execute Package Utility
Version 14.0.3037.1 for 32-bit
Copyright (C) 2017 Microsoft. All rights reserved.

Started:  7:41:12 AM
Execution ID: 161422.
To view the details for the execution, right-click on the Integration Services Catalog, and open the [All Executions] report
Started:  7:41:12 AM
Finished: 7:41:30 AM
Elapsed:  18.39 seconds

第一个默认执行无需花费时间,因为它将责任移交给了SQL Server本身。 第二个强迫我们实时获取消息,因此需要15秒+设置时间

上面显示的是加载和执行程序包的实际时间。 包的运行时就是您想要的。

通常的做法是将行写到审计表中,然后通过将包ID和当前时间,名称以及所需的其他内容写到表中来启动包(错误消息等)。

在打包结束时,您可以使用结束时间更新数据库中的行。

您可以查询此表并比较开始时间和结束时间,以找到运行程序包的总时间。

我们通常在此处使用的审计表示例;

USE [database]
GO


SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[dim_audit](
    [AuditKey] [int] IDENTITY(1,1) NOT NULL,
    [ParentAuditKey] [int] NOT NULL,
    [TableName] [nvarchar](50) NOT NULL,
    [PkgName] [nvarchar](50) NOT NULL,
    [PkgGUID] [uniqueidentifier] NULL,
    [PkgVersionGUID] [uniqueidentifier] NULL,
    [PkgVersion] [nvarchar](50) NULL,
    [ExecStartDT] [datetime] NOT NULL,
    [ExecStopDT] [datetime] NULL,
    [ExecutionInstanceGUID] [uniqueidentifier] NULL,
    [ExtractRowCnt] [bigint] NULL,
    [InsertRowCnt] [bigint] NULL,
    [UpdateRowCnt] [bigint] NULL,
    [DeleteRowCnt] [bigint] NULL,
    [TableInitialRowCnt] [bigint] NULL,
    [TableFinalRowCnt] [bigint] NULL,
    [TableMaxSurrogateKey] [bigint] NULL,
    [SuccessfulProcessingInd] [nchar](1) NOT NULL,
 CONSTRAINT [PK_dim_audit] PRIMARY KEY CLUSTERED 
(
    [AuditKey] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM