1. 程式人生 > >SSISDB8:查看SSISDB記錄Package執行的消息

SSISDB8:查看SSISDB記錄Package執行的消息

應該 失敗 led result ner ont 設置 contex sele

在執行Package時,SSISDB都會創建唯一的OperationID 和 ExecutionID,標識對package執行的操作和執行實例(Execution Instance),並記錄operation message,統計executable的執行時間,便於developers 優化package的設計,對package進行故障排除。

一,在package發生錯誤時,查看失敗的Executable

An executable is a task or container that you add to the control flow of a package.

技術分享
select e.project_name,    
    opt.operation_type_descr as Operation,
    obt.object_type_descr as object_type,
    e.object_id,
    ops.operation_status_descr as operation_status,
    et.package_name,
    et.package_path as ExecutablePath,--relative path
    --es.execution_path as ExecutableFullPath,
    et.executable_name,
    cast(es.execution_duration/1000/60.0 as decimal(10,1))as Duration_M,
    er.execution_result_descr as execution_result,
    es.start_time 
    --,es.end_time,
from catalog.executions e
inner join helper.OperationType opt 
    on e.operation_type=opt.operation_type
inner join helper.ObjectType obt 
    on e.object_type=obt.object_type
inner join helper.OperationStatus ops 
    on e.status=ops.operation_status
inner join catalog.executables et
    on e.execution_id=et.execution_id
inner join catalog.executable_statistics es
    on et.executable_id=es.executable_id and et.execution_id=es.execution_id
inner join helper.ExecutionResult er 
    on es.execution_result=er.execution_result
where e.execution_id=104627        --Specified ExecutionID
    --and es.execution_result=1       -- 1 (Failure)
    --and et.package_name=N‘PackageName.dtsx‘
order by et.package_name,es.start_time
技術分享

二,查看Operation記錄的message

1, SSIS 記錄海量的Operation Message 和Event Message 數據,在查看這些文本信息時,應該設置好查詢條件。

技術分享
select 
    opt.operation_type_descr as Operation,
    obt.object_type_descr as object_type,
    o.object_name,
    ops.operation_status_descr as OperationStatus,
    mt.message_type_descr as message_type,
    mst.message_source_descr,
    om.message,
    om.message_time
from catalog.operations o
inner join helper.OperationType opt
    on o.operation_type=opt.operation_type
inner join helper.ObjectType obt 
    on o.object_type=obt.object_type
inner join helper.OperationStatus ops
    on o.status=ops.operation_status
inner join catalog.operation_messages om
    on o.operation_id=om.operation_id
inner join helper.MessageType mt 
    on om.message_type=mt.message_type
inner join helper.MessageSourceType mst 
    on om.message_source_type=mst.message_source_type
where o.operation_id =104627 
    and om.message_type in
    (
        120,--Error
        110,--Warning
        130--TaskFailed
    )
order by om.message_time desc
技術分享

2,查看Operation 的Event message,對Package進行troubleshoot時,Event Message非常有用

技術分享
select
    opt.operation_type_descr as Operation,
    obt.object_type_descr as object_type,
    o.object_name,
    ops.operation_status_descr as OperationStatus,
    em.event_message_id,
    em.package_name,
    em.event_name,
    em.message_source_name,
    em.subcomponent_name,
    mt.message_type_descr as message_type,
    mst.message_source_descr as message_source_type,
    em.package_path,
    em.event_message_id,
    em.message_time,
    em.message
from catalog.operations o
inner join helper.OperationType opt 
    on o.operation_type=opt.operation_type
inner join helper.OperationStatus ops 
    on o.status=ops.operation_status
inner join helper.ObjectType obt 
    on o.object_type=obt.object_type
inner join catalog.event_messages em
    on o.operation_id=em.operation_id
inner join helper.MessageType mt 
    on em.message_type=mt.message_type
inner join helper.MessageSourceType mst 
    on em.message_source_type=mst.message_source_type
where o.operation_id =104627 
    and em.message_type in
    (
        120,    --Error
        110,    --Warning
        130     --TaskFailed;
    )
    --and em.package_name=N‘PackageName.dtsx‘
order by em.message_time desc
技術分享

3,查看Event Message 的Context,以及相應的Property 和PropertyValue,這是最底層的SSIS 執行時Event 記錄的值,能夠查看到Package執行時的連接字符串的值

技術分享
select emc.context_depth,
    emc.package_path,
    ct.context_type_name as context_type,
    emc.context_source_name,
    emc.property_name,
    emc.property_value
from catalog.event_message_context emc
inner join helper.ContextType ct 
    on emc.context_type=ct.context_type
where emc.event_message_id=23929777
and emc.context_type=70
技術分享

Appendix:

關於輔助表,請參考《SSISDB6:Operation》的附件

參考文檔:

Views (Integration Services Catalog)

SSIS Catalog

SSISDB8:查看SSISDB記錄Package執行的消息