Script1,查看错误发生时,某个Package执行Executable的属性和Executable的执行结果
select e.project_name, e.operation_type, --refer to [catalog].[operations] --e.package_name as FristExecutePackagename,e.object_type,e.object_id,e.status, et.package_name,et.package_path as ExecutablePath,et.executable_name,--es.execution_path as ExecutableFullPath, es.execution_duration as Execution_Duration_MS, es.execution_result,es.start_time --,es.end_time, from catalog.executions e 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 where e.execution_id=103600 --Specified ExecutionID --and es.execution_result=1 and et.package_name=N‘PackageName.dtsx‘ order by et.package_name,es.start_time
SSIS 记录海量的Operation Message 和Event Message 数据,在查看这些文本信息时,应该设置好查询条件。
Script2,查看Operation记录的message
--OperationType=200: create_execution and start_execution --OperationStatus: created(1),running(2),canceled(3),failed(4),pending(5),ended unexpectedly(6), -- succeeded(7),stopping(8),and completed(9) --MessageType: 120 Error, 110 Warning, 130 TaskFailed --Message Source Type --10 Entry APIs --20 External process used to run package --30 Package-level objects --40 Control Flow tasks --50 Control Flow containers --60 Data Flow task select o.operation_type,o.object_name,o.status as OperationStatus,--o.start_time,o.end_time, om.message_type,om.message_source_type,om.message,om.message_time from catalog.operations o inner join catalog.operation_messages om on o.operation_id=om.operation_id where o.operation_id =103600 and om.message_type in ( 120,--Error 110,--Worning 130--TaskFailed ) order by om.message_time desc
Script3,查看Operation 相关的Event message,并记录Event message 对应的event_message_id,可以查看时间发生时的Event Context。
--OperationType=200: create_execution and start_execution --OperationStatus: created(1),running(2),canceled(3),failed(4),pending(5),ended unexpectedly(6), -- succeeded(7),stopping(8),and completed(9) --MessageType: 120 Error, 110 Warning, 130 TaskFailed --Message Source Type --10 Entry APIs --20 External process used to run package --30 Package-level objects --40 Control Flow tasks --50 Control Flow containers --60 Data Flow task select o.operation_type,o.object_name,o.status as OperationStatus, em.package_name,em.event_name,em.message_source_name,em.subcomponent_name, em.message_type,em.message_source_type,em.package_path,em.event_message_id,em.message_time from catalog.operations o inner join catalog.event_messages em on o.operation_id=em.operation_id where o.operation_id =103600 and em.message_type in ( 120, --Error 110, --Worning 130 --TaskFailed; ) and em.package_name=N‘PackageName.dtsx‘ order by em.message_time asc
script4,查看Event Message 的Context,以及相应的Property 和PropertyValue,这是最底层的SSIS 执行时Event 记录的值,便于Troubleshoot。
--ContextType: 10 Task, 30 Sequence, 40 Foreach Loop, 60 Package, 70 Variable, 80 Connection manager, -- 20 Pipeline(source, destination, or transformation component) select emc.context_depth,emc.package_path,emc.context_type,emc.context_source_name,emc.property_name,emc.property_value from catalog.event_message_context emc where emc.event_message_id=23929777 and emc.context_type=70
参考文档:
https://msdn.microsoft.com/en-us/library/ff878135(v=sql.110).aspx
https://msdn.microsoft.com/en-us/library/hh479588(v=sql.110).aspx
时间: 2024-10-13 05:46:43