9

I have exhausted my resources and can't find a foolproof way to join the ssisdb.catalog tables to the jobs that run them. Trying to write some custom sprocs to monitor my execution times and rows written from the catalog tables, and it would be greatly beneficial to be able to tie them together with the calling job.

I'm trying to find out if there are any tables that can be used to join the catalog.executions table to msdb.sysjobhistory. I need to relate which job called the SSIS package and then use the data in executions for my analysis.

5

Not for any case. But I have some way:

It is designed for only for the case in the message table sysjobhistory, appears string:

"Execution ID: xxxxxxx".

In the following query, in the last column I extract the ExecutionId.

In the case ExecutionId has a value, it can join:

SELECT * 
FROM (
    SELECT 
        h.step_name,  
        h.message, 
        h.run_status, 
        h.run_date, 
        h.run_time, 
        SUBSTRING(h.message, NULLIF(CHARINDEX('Execution ID: ', h.message),0)+14 ,PATINDEX('%[^0-9]%',SUBSTRING(h.message, NULLIF(CHARINDEX('Execution ID: ', h.message),0)+14 ,20))-1) ExecutionId
    FROM MSDB.DBO.SYSJOBHISTORY h) history
LEFT JOIN 
SSISDB.CATALOG.EXECUTIONS ex on ex.execution_id = history.ExecutionId

Note that can also attach these tables:

LEFT JOIN SSISDB.CATALOG.OPERATION_MESSAGES om on history.ExecutionId = om.operation_id
LEFT JOIN SSISDB.CATALOG.EVENT_MESSAGES em on em.operation_id =history.ExecutionId 
2

Update: The short answer is : There is NO way of joining ssisdb.catalog tables to the jobs that run them. There is some good info available in these articles by Jamie Thomson:

I guess, what you are trying to do is already being done by Jamie. Refer to the sp_ssis_catalog to see if it meets your needs or not.

I did not find a way to join ssisdb.catalog tables to the jobs that run them. You can refer to the following for some insight to get the job name:

SSIS Error Report Email by Clark Baker

0
0

The short answer is YES

SELECT TOP 200
M.[Message_time],
(SELECT TOP 1 Name from MSDB.dbo.SysJobs J INNER JOIN MSDB.dbo.SysJobSteps S (NOLOCK) ON 
        J.Job_ID = S.Job_ID WHERE S.Command like '%' +  M.[Package_Name] + '%') as Job_Name,
M.[Package_Name],
M.[Execution_path],
M.[Subcomponent_name],
M.[Message]
FROM SSISDB.[catalog].[Event_messages] M (NOLOCK)    
WHERE Event_name = 'OnError'
ORDER BY Message_time DESC

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.