Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Find unused packages

$
0
0

 Hey all,

I am trying to write a query in order to remove the unused packages (along with tables etc). So I thought to write something like the below query. But it's not so accurate as I don't count packages that run once per week/month. Any idea to improve it or write another one based on other SSIS catalog tables?

--Show me all the packages that didn't run the last 3 days

  SELECT TOP (1000) [package_id]
      ,[project_version_lsn]
      ,[name]
      ,[package_guid]
      ,[description]
      ,[package_format_version]
      ,[version_major]
      ,[version_minor]
      ,[version_build]
      ,[version_comments]
      ,[version_guid]
      ,[project_id]
      ,[entry_point]
      ,[validation_status]
      ,[last_validation_time]
      ,[package_data]
  FROM [SSISDB].[internal].[packages]
  WHERE name NOT IN (
  SELECT 
  --[execs].[statistics_id]  --Unique ID of the data.
  --    ,[execs].[execution_id]   --Unique ID for the instance of the execution.
  --    ,
	  [exec].package_name      --The name of the package.
      --,[exec].executable_name   --The name of the executable.
      --,[exec].executable_id     --Unique ID for the package component.
      --,[execs].[execution_path] --The full execution path of the package component, including each iteration of the component.
      --,cast ([execs].[start_time] as date) Execution_date
      --,[execs].[start_time] --The time when the executable enters the pre-execute phase.
      --,[execs].[end_time]   --The time when the executable enters the post-execute phase.
      --,[execs].[execution_duration] as 'execution_duration_msec'-- The length of time the executable spent in execution. The value is in milliseconds.
      --,[execs].[execution_duration]/1000 as 'execution_duration_sec' -- The length of time the executable spent in execution. The value is in seconds.
      --,CASE  WHEN [execs].execution_result=0 THEN 'Success' WHEN [execs].execution_result=1 THEN 'Failure' WHEN [execs].execution_result=2 THEN 'Completion' WHEN [execs].execution_result=3 THEN 'Cancelled'END AS execution_result
  FROM [SSISDB].[catalog].[executable_statistics] [execs]
  INNER JOIN [SSISDB].[catalog].[executables] [exec] ON execs.executable_id = [exec].executable_id and execs.execution_id = [exec].execution_id
  where cast([execs].start_time as date)  between '2018-07-29' and '2018-08-01'
  )



Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>