Включить кэширование для всех отчетов на сервере отчетов SSRS

У меня более 100 отчетов на сервере отчетов SSRS. Мне нужно включить кэширование для всех из них. Прямо сейчас я включаю кэширование через диспетчер отчетов для каждого отчета.

Можем ли мы добавить кэширование в любой из файлов конфигурации серверов отчетов? Чтобы мы могли включить кэширование для всех отчетов в одном месте.

Любая помощь будет оценена

Спасибо, Эй Джей.


person Jan_Cool    schedule 07.12.2012    source источник
comment
Кэширование задается для каждого отчета или общего набора данных, поэтому его невозможно установить в файле конфигурации. Лучшим вариантом может быть использование rs script host или powershell. См. social.msdn.microsoft. .com/Forums/en-US/sqlreportingservices/ для аналогичного вопроса   -  person user1578107    schedule 09.12.2012
comment
Спасибо! Скрипт Powershell заработал!   -  person Jan_Cool    schedule 06.03.2013


Ответы (1)


Ниже приведен сценарий, который я использовал для включения кэширования в минутах в списке отчетов.

Сохраните его как setreportscaching.rss и запустите из командной строки:

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

Его легко изменить, чтобы он перебирал файлы в какой-либо папке, а не брал список отчетов в формате csv. В нем есть какая-то глупая часть диагностики, которую можно закомментировать для скорости.

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
person demp    schedule 22.08.2013