36774

Enable Caching for all reports in SSRS Report Server

Question:

I have more than 100 reports in SSRS report server. I need to enable caching for all of those. Right now I am enabling caching through the report manager for each and every report.

<strong>Can we add caching in any of the report servers config files?</strong> So that we can enable caching for all reports at a single place.

Any help will be appreciated

Thanks AJ

Answer1:

Below is the script that I used to enable caching in minutes on a list of reports.

Save it as setreportscaching.rss and then run it from the command line:

rs.exe -i setreportscaching.rss -e Mgmt2010 -t -s http://mySsrsBox:8080/ReportServer -v ReportNamesList="OneReport,AnotherReport,YetAnotherOne" -v CacheTimeMinutes="333" -v TargetFolder="ReportsFolderOnServer"

It is easy to modify it to loop through files in some folder rather then take csv list of reports. It has some silly piece of diagnostics that can be commented out for speed.

Public Sub Main() Dim reportNames As String() = Nothing Dim reportName As String Dim texp As TimeExpiration Dim reportPath As String Console.WriteLine("Looping through reports: {0}", ReportNamesList) reportNames = ReportNamesList.Split(","c) For Each reportName In reportNames texp = New TimeExpiration() texp.Minutes = CacheTimeMinutes reportPath = "/" + TargetFolder + "/" + reportName 'feel free to comment out this diagnostics to speed things up Console.WriteLine("Current caching for " + reportName + DisplayReportCachingSettings(reportPath)) 'this call sets desired caching option rs.SetCacheOptions(reportPath, true, texp) 'feel free to comment out this diagnostics to speed things up Console.WriteLine("New caching for " + reportName + DisplayReportCachingSettings(reportPath)) Next End Sub Private Function DisplayReportCachingSettings(reportPath as string) Dim isCacheSet As Boolean Dim expItem As ExpirationDefinition = New ExpirationDefinition() Dim theResult As String isCacheSet = rs.GetCacheOptions(reportPath, expItem) If isCacheSet = false Or expItem is Nothing Then theResult = " is not defined." Else If expItem.GetType.Name = "TimeExpiration" Then theResult = " is " + (CType(expItem, TimeExpiration)).Minutes.ToString() + " minutes." ElseIf expItem.GetType.Name = "ScheduleExpiration" Then theResult = " is a schedule" Else theResult = " is " + expItem.GetType.Name End If End If DisplayReportCachingSettings = theResult End Function

Recommend

  • SSRS WindowsIdentity.GetCurrent() giving me NT AUTHORITY\\NETWORK SERVICE
  • Can you rotate through visible sub reports in report builder 3?
  • SSRS 2005 in ReportServer and ReportServerTempDB in SQL Server 2008
  • The permissions granted to user 'servername/iusr-username' are insufficient for performing
  • Reportico : yii2 How to embed Links?
  • Save a byte array to excel file
  • Exception in using bootstrap-storage-plugins.json file for storage plugin in apache-drill
  • Multiline edit in awk
  • Run time error '3052'. File sharing lock count exceeded. Increase MaxLocksPerFile registry
  • Parse.com to communicate with WSDL
  • Problem fetching XML data using Expedia API and curl
  • loop update statement in classic asp
  • Compiling Rust static library and using it in C++: undefined reference
  • Configuring a Node.js application to work with Websockets over TCP as well as AWS S3
  • datagrid 6 in VB 6.0
  • Spring Boot Application Unable to start?
  • fill javaFX treeView from database dynamically
  • c3p0 ResultSet.unwrap throws an AbstractMethodError
  • JBoss - How can to exclude javax.validation in jboss-deployment-structure?
  • Mutable borrow seems to outlive its scope
  • string variables concatenated in SQL (to access DB), Syntax errors due to quotations?
  • 404 response on simple RESTeasy example with Tomcat
  • JList not showing on JScrollPane
  • Apigee - Issue while configuring an API Proxy
  • JAX-RS and JSON messed up
  • Execute SQL Server stored procedure through VBA which does not return rows
  • CXF/Jetty equivalent of the following Jersey/Jetty code
  • In Jaspersoft Studio, Sql server procedure returning fewer fields than expected
  • Neo4j: Enforcing schema with XSD
  • How to handle Service unavailable scenarios with Jersey REST
  • SQL Error : integrity constraint violation : foreign key no parent
  • WCF web service returning json format data
  • R connection to postgresql requiring SSL
  • How to get rid of “No jax-rs activator is defined for the project” warning?
  • Update recordset without updating database
  • Handle Authentication and Authorization in jax-rs webservice with cxf
  • How to get text which is not part of any element using jsoup?
  • Is it possible to specialize on a static lifetime?
  • Get a trait object reference from a vector
  • Display Images one by one with next and previous functionality