Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to maintain SQL Server Reporting Services job subscription in SQL Server Agent job history

Posted on 2014-12-02
4
Medium Priority
?
206 Views
Last Modified: 2016-06-16
SSRS subscription jobs under SQL Server AgentUsing SQL Server 2008 R2 and SQL Server Reporting Services (SSRS)

When I schedule an SSRS report in SQL Server Reporting Services - Report Manager, it creates a subscription in SSRS.
In Microsoft SQL Server Management Studio under SQL Server Agent a new Job is added with a cryptic job name.
Please see attached snapshot for example.

How do I clean up those SSRS subcription jobs under SQL Server Agent?
For example, what if I only wanted to maintain 30 days worth of job history?
What procedure do I follow?

Thank you.

ssrs1212014
0
Comment
Question by:ssrs1212014
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 1000 total points
ID: 40478015
That "cryptic job name" is called a GUID, or a uniqueidentifier.

To limit the job history:

Right-hand click on SQL Server Agent
Go to Properties
Go to History

There you can limit the maximum job history log size (in rows), the maximum rows per job, and remove agent history older than X days/weeks/months.
0
 

Author Comment

by:ssrs1212014
ID: 40478437
thank you Phillip.
0
 
LVL 28

Assisted Solution

by:Ryan McCauley
Ryan McCauley earned 1000 total points
ID: 40528363
Many of those SQL Agent jobs may be for expired subscriptions or no longer valid - we use the following query to determine if they can be safely removed:

   select c.Name as ReportName,
                  s.EventType,
                  s.Description as SubscriptionDescription,
                  s.LastStatus as LastSubscriptionStatus,
                  s.LastRunTime SubscriptionLastRunTime,
                  case
                     when recurrencetype = 1 then 'One Time'
                     when recurrencetype = 2 then 'Hourly'
                     when recurrencetype = 4 then 'Daily'
                     when recurrencetype = 5 then 'Monthly' 
                     when recurrencetype = 6 then 'Month Week' 
                     else 'Other'
                  end as RecurranceType,
                  s.DeliveryExtension,
                  u.UserName as SubscriptionSetUpBy,
                  s.ModifiedDate as SubscriptionLastModifiedDate
             from [ReportServer].[dbo].[Subscriptions] s
             join [ReportServer].[dbo].[Catalog] c
               on c.ItemID = s.Report_OID
             join [ReportServer].[dbo].[Users] u
               on u.UserID = s.OwnerID
             join [ReportServer].[dbo].[reportschedule] rs
               on c.itemid = rs.reportid 
              and s.subscriptionid = rs.subscriptionid
             join [ReportServer].[dbo].[schedule] sch
               on rs.scheduleid = sch.scheduleid
            where s.EventType <> 'RefreshCache'
              and s.LastRunTime < dateadd(m,-3,getdate())
         order by c.name

Open in new window


It will list any jobs that haven't been executed in the past three months, and you can likely remove any of those safely (though it includes Username, so you can contact them to ensure it's not necessary to keep).
1

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question