Search code examples
sql-serverssisdatabase-administration

Colleague can't query SSISDB


I'm trying to grant access to a colleague to allow them to query on SSISDB package errors.

I've given them access to the database (SSISDB) with db_datareader. Under Logins > Properties > User Mapping.

The query executes fine for my colleague, but produces no results.

n.b. not my query, stumbled across this online a while ago. But gives me good results.

USE SSISDB;
GO
SELECT TOP 1000 [execution_id]
      ,[folder_name]
      ,[project_name]
      ,ex.[package_name]
         ,MESSAGE
      ,[project_lsn]
      ,[executed_as_name]
      ,[use32bitruntime]
      ,[status]
         ,CASE [status]
              WHEN 1 THEN 'Created'
              WHEN 2 THEN 'Running'
              WHEN 3 THEN 'Canceled'
              WHEN 4 THEN 'Failed'
              WHEN 5 THEN 'Pending'
              WHEN 6 THEN 'Ended unexpectedly'
              WHEN 7 THEN 'Succeeded'
              WHEN 8 THEN 'Stopping'
              WHEN 9 THEN 'Completed'
              ELSE 'ADDITIONAL VALUE - PLEASE CHECK CASE STATEMENT'
         END StatusDescription
      ,[start_time]
      ,[end_time]
      ,[caller_name]
      ,[process_id]
      ,[stopped_by_sid]
      ,[stopped_by_name]
      ,[server_name]
  FROM [SSISDB].[catalog].[executions] ex
       LEFT OUTER JOIN SSISDB.catalog.event_messages em
    ON em.operation_id = ex.execution_id
       AND event_name NOT LIKE '%Validate%'
       AND MESSAGE LIKE '%An error occurred%'
  where start_time > GETDATE() - 7 --last weeks errors
  AND status not in (2, 7, 9)
  order by [execution_id] desc

When I run this, I am given a list of failed SSIS packages and the errors messages. However, when my colleague runs this - the output is blank.

Any help much appreciated.


Solution

  • I got around this by adding the user into the ssis_admin role.