手动配置 SQL Server Reporting Services 的步骤
在部署 Service Manager 数据仓库管理服务器期间,可以指定将MICROSOFT SQL Server Reporting Services(SSRS)部署到的服务器。 默认情况下,在安装过程中会选择承载数据仓库管理服务器的计算机。 如果指定要托管 SSRS 的其他计算机,系统会提示你按照此过程准备服务器。 准备远程计算机来承载 SSRS 涉及本部分所详述的下列步骤:
将 Microsoft.EnterpriseManagement.Reporting.Code.dll 从 Service Manager 安装介质复制到承载 SSRS 的计算机。
在承载 SSRS 的计算机上的 rssrvpolicy 配置文件中添加代码段。
在同一台计算机上的 rsreportserver 配置文件中,向现有 Data 段中添加一个 Extension 标记。
如果使用了 SQL Server 的默认实例,请使用 Windows 资源管理器将 Microsoft.EnterpriseManagement.Reporting.Code.dll(位于 Service Manager 安装介质上的先决条件文件夹中)拖到文件夹 \Program Files\Microsoft SQL Server\MSRS13。承载 SSRS 的计算机上的 MSSQLSERVER\Reporting Services\ReportServer\Bin。 如果未使用 SQL Server 的默认实例,所需文件夹的路径为 \Program Files\Microsoft SQL Server\MSRS13。<>INSTANCE_NAME\Reporting Services\ReportServer\Bin。 在以下过程中,使用了默认实例名称。
复制 Microsoft.EnterpriseManagement.Reporting.Code.dll 文件
请使用以下步骤:
在将承载远程 SSRS 的计算机上,打开一个 Windows 资源管理器实例。
对于 SQL Server 2016,找到文件夹 \Program Files\Microsoft SQL Server\MSRS13。MSSQLSERVER\Reporting Services\ReportServer\Bin。
启动 Windows 资源管理器的第二个实例,找到包含 Service Manager 安装介质的驱动器,然后打开“先决条件”文件夹。
在“先决条件”文件夹中,选择 “Microsoft.EnterpriseManagement.Reporting.Code.dll”,然后将其拖动到你位于任一步骤 2 中的文件夹。
将代码段添加到 rssrvpolicy.config 文件
请使用以下步骤:
在承载 SSRS 的计算机上,在 \Program Files\Microsoft SQL Server\MSRS13 中找到文件 rssrvpolicy.config。SQL Server 2016 的 MSSQLSERVER\Reporting Services\ReportServer 文件夹。
使用所选的 XML 编辑器(如记事本)打开 rssrvpolicy.config 文件。
滚动浏览 rssrvpolicy.config 文件并找到
<CodeGroup>
代码段。 以下代码显示了段<CodeGroup>
的示例。<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust"> <IMembershipCondition class="UrlMembershipCondition" version="1" Url="$CodeGen$/*" /> </CodeGroup>
将以下
<CodeGroup>
段全部添加到与其他<CodeGroup>
段相同的部分。<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" Name="Microsoft System Center Service Manager Reporting Code Assembly" Description="Grants the SCSM Reporting Code assembly full trust permission."> <IMembershipCondition class="StrongNameMembershipCondition" version="1" PublicKeyBlob="0024000004800000940000000602000000240000525341310004000001000100B5FC90E7027F67871E773A8FDE8938C81DD402BA65B9201D60593E96C492651E889CC13F1415EBB53FAC1131AE0BD333C5EE6021672D9718EA31A8AEBD0DA0072F25D87DBA6FC90FFD598ED4DA35E44C398C454307E8E33B8426143DAEC9F596836F97C8F74750E5975C64E2189F45DEF46B2A2B1247ADC3652BF5C308055DA9" /> </CodeGroup>
保存更改并关闭 XML 编辑器。
将扩展标记添加到 rsreportserver.conf 文件中的数据段
请使用以下步骤:
在承载 SSRS 的计算机上,在 \Program Files\Microsoft SQL Server\MSRS13 中找到文件 rsreportserver.config。SQL Server 2016 的 MSSQLSERVER\Reporting Services\ReportServer 文件夹。
使用所选的 XML 编辑器(例如记事本)打开 rsreportserver.config 文件。
滚动浏览 rsreportserver.config 文件并找到
<Data>
代码段。 此文件中只有一个<Data>
代码段。将以下
Extension
标记添加到<Data>
所有其他Extension
标记所在的代码段:<Extension Name="SCDWMultiMartDataProcessor" Type="Microsoft.EnterpriseManagement.Reporting.MultiMartConnection, Microsoft.EnterpriseManagement.Reporting.Code" />
保存更改并关闭 XML 编辑器。
验证 SSRS 安装
在 Service Manager 数据仓库 (DW) 版本 2016 及更高版本中,观察到以下已知问题:
在 Service Manager 数据仓库(DW)中,观察到以下已知问题:
如果 SQL Server Reporting Services (SSRS) 在数据仓库管理服务器上本地运行,并且 SSRS 为 2017 或更高版本,则数据仓库安装程序会成功完成,但可能无法正确配置指定的本地 SSRS 实例。
使用以下脚本验证 是否已正确配置 LOCAL SSRS 安装,并可用于 Service Manager 数据仓库。
注意
可以在 Service Manager 数据仓库安装后执行此 PowerShell 脚本。 该脚本不会对配置进行任何更改,但会对其进行验证。 可以根据需要多次运行脚本。
#region function definitions
function SelfElevate() {
#got from http://www.expta.com/2017/03/how-to-self-elevate-powershell-script.html and changed a bit
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
if ([int](Get-WmiObject -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
$CommandLine = "-File `"" + $Script:MyInvocation.MyCommand.Path + "`" " + $Script:MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
Exit
}
}
}
function EndScriptExecution() {
Write-Host ""
Read-Host "Press ENTER to stop execution"
Exit
}
#endregion
#region Init
SelfElevate
#endregion
#region Select SSRS service
$ssrsServicesAvailable = gwmi win32_service | ?{ $_.DisplayName -like 'SQL Server Reporting Services*' }
if ($ssrsServicesAvailable -eq $null) {
Write-Host "No SSRS service(s) detected on this machine. " -NoNewline
Write-Host "Aborting ..." -ForegroundColor Yellow
EndScriptExecution
}
if ( ($ssrsServicesAvailable | Measure-Object).Count -eq 1) {
$ssrsServiceToVerify = ($ssrsServicesAvailable | Select-Object -Property DisplayName, State, PathName) | Select-Object -First 1
}
else {
$ssrsServiceToVerify = $ssrsServicesAvailable | Select-Object -Property DisplayName, State, PathName | Out-GridView -Title 'Select the SSRS service to verify and then click OK...' -OutputMode Single
if ($ssrsServiceToVerify -eq $null) {
Write-Host "No SSRS service selected to verify. " -NoNewline
Write-Host "Aborting ..." -ForegroundColor Yellow
EndScriptExecution
}
}
#endregion
#region Preparation
Write-Host "--------------------------------------------------------------------"
Write-Host "Verifiying selected SSRS service : " -NoNewline
Write-Host "'$($ssrsServiceToVerify.DisplayName)'" -ForegroundColor Cyan
Write-Host "--------------------------------------------------------------------"
Write-Host ""
$ssrsExePath = $ssrsServiceToVerify.PathName.Replace('"','')
$ssrsExeFileVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($ssrsExePath)
$ssrsMajorVersion = $ssrsExeFileVersion.ProductMajorPart
$ssrsVersionDisplayName = switch ($ssrsMajorVersion)
{
11 {"2012"}
12 {"2014"}
13 {"2016"}
14 {"2017"}
15 {"2019"}
default {""}
}
if ($ssrsVersionDisplayName -eq "") {
Write-Host "Unknown SSRS Version detected. " -NoNewline
Write-Host "Aborting ..." -ForegroundColor Yellow
EndScriptExecution
}
[System.IO.DirectoryInfo]$ssrsReportServerFolder = (Get-Item -Path $ssrsExePath).Directory.Parent
if ($ssrsMajorVersion -ge 14) {
$ssrsReportServerFolder = Join-Path $ssrsReportServerFolder.FullName "ReportServer"
}
[string]$ssrsReportServerFolder = $ssrsReportServerFolder.FullName
[string]$ssrsReportServerBinFolder = Join-Path $ssrsReportServerFolder "bin"
#endregion
#region Checking DLL
$scsmDllFileExists = $false
$scsmDllFileName = "Microsoft.EnterpriseManagement.Reporting.Code.dll"
$scsmDllFilePath = Join-Path $ssrsReportServerBinFolder $scsmDllFileName
$scsmDllFileExists = (Test-Path -Path $scsmDllFilePath)
if (-not $scsmDllFileExists) {
Write-Host "ERROR: " -ForegroundColor Yellow -NoNewline
Write-Host "The file '$scsmDllFileName' does *NOT* exist in '$ssrsReportServerBinFolder'"
}
else {
Write-Host " Pass: The file '$scsmDllFileName' does exist in '$ssrsReportServerBinFolder'"
}
Write-Host ""
#endregion
#region Checking rssrvpolicy.config
$rssrvpolicy_configIsCorrect = $false
$rssrvpolicy_configFileName = "rssrvpolicy.config"
$rssrvpolicy_configFilePath = Join-Path $ssrsReportServerFolder $rssrvpolicy_configFileName
$rssrvpolicy_configFileExists = (Test-Path -Path $rssrvpolicy_configFilePath)
if (-not $rssrvpolicy_configFileExists) {
Write-Host "$rssrvpolicy_configFileName does *NOT* exist in $ssrsReportServerFolder" -ForegroundColor Yellow
}
if ($rssrvpolicy_configFileExists) {
[xml]$xml = Get-Content $rssrvpolicy_configFilePath
$tagNameToFind = "CodeGroup"
$attributeNameToFind = "Name"
$attributeValueToFind = "Microsoft System Center Service Manager Reporting Code Assembly"
$nodeToFind = Select-Xml -XPath "//$tagNameToFind[@$attributeNameToFind='$attributeValueToFind']" -Xml $xml
if ($nodeToFind -eq $null) {
Write-Host "ERROR: " -ForegroundColor Yellow -NoNewline
Write-Host "The file '$rssrvpolicy_configFileName' in '$ssrsReportServerFolder' does *NOT* contain the correct <$tagNameToFind> node."
}
else {
$CodeGroup_NodeToVerify = [System.Xml.XmlNode]$nodeToFind.Node
$IMembershipCondition_NodeToVerify = [System.Xml.XmlNode]$CodeGroup_NodeToVerify.IMembershipCondition
$rssrvpolicy_configIsCorrect = ( $CodeGroup_NodeToVerify.class -eq "UnionCodeGroup" `
-and $CodeGroup_NodeToVerify.version -eq "1" `
-and $CodeGroup_NodeToVerify.PermissionSetName -eq "FullTrust" `
-and $IMembershipCondition_NodeToVerify.class -eq "StrongNameMembershipCondition" `
-and $IMembershipCondition_NodeToVerify.version -eq "1" `
-and $IMembershipCondition_NodeToVerify.PublicKeyBlob -eq "0024000004800000940000000602000000240000525341310004000001000100B5FC90E7027F67871E773A8FDE8938C81DD402BA65B9201D60593E96C492651E889CC13F1415EBB53FAC1131AE0BD333C5EE6021672D9718EA31A8AEBD0DA0072F25D87DBA6FC90FFD598ED4DA35E44C398C454307E8E33B8426143DAEC9F596836F97C8F74750E5975C64E2189F45DEF46B2A2B1247ADC3652BF5C308055DA9"
)
if (-not $rssrvpolicy_configIsCorrect) {
Write-Host "ERROR: " -ForegroundColor Yellow -NoNewline
Write-Host "The <$tagNameToFind> node in '$rssrvpolicy_configFileName' in '$ssrsReportServerFolder' does exists but its content is *NOT* correct."
}
else {
Write-Host " Pass: The content of '$rssrvpolicy_configFileName' in '$ssrsReportServerFolder' is correct."
}
}
}
Write-Host ""
#endregion
#region Checking rsreportserver.config
$rsreportserver_configIsCorrect = $false
$rsreportserver_configFileName = "rsreportserver.config"
$rsreportserver_configFilePath = Join-Path $ssrsReportServerFolder $rsreportserver_configFileName
$rsreportserver_configFileExists = (Test-Path -Path $rsreportserver_configFilePath)
if (-not $rsreportserver_configFileExists) {
Write-Host "$rsreportserver_configFileName does *NOT* exist in $ssrsReportServerFolder" -ForegroundColor Yellow
}
if ($rsreportserver_configFileExists) {
[xml]$xml = Get-Content $rsreportserver_configFilePath
$tagNameToFind = "Extension"
$attributeNameToFind = "Name"
$attributeValueToFind = "SCDWMultiMartDataProcessor"
$nodeToFind = Select-Xml -XPath "//$tagNameToFind[@$attributeNameToFind='$attributeValueToFind']" -Xml $xml
if ($nodeToFind -eq $null) {
Write-Host "ERROR: " -ForegroundColor Yellow -NoNewline
Write-Host "The file '$rsreportserver_configFileName' in '$ssrsReportServerFolder' does *NOT* contain the correct <$tagNameToFind> node."
}
else {
$Extension_NodeToVerify = [System.Xml.XmlNode]$nodeToFind.Node
$rsreportserver_configIsCorrect = ( $Extension_NodeToVerify.Type.Replace(" ","") -eq "Microsoft.EnterpriseManagement.Reporting.MultiMartConnection, Microsoft.EnterpriseManagement.Reporting.Code".Replace(" ","") )
if (-not $rsreportserver_configIsCorrect) {
Write-Host "ERROR: " -ForegroundColor Yellow -NoNewline
Write-Host "The <$tagNameToFind> node in '$rsreportserver_configFileName' in '$ssrsReportServerFolder' does exists but its content is *NOT* correct."
}
else {
Write-Host " Pass: The content of '$rsreportserver_configFileName' in '$ssrsReportServerFolder' is correct."
}
}
}
Write-Host ""
#endregion
#region Conclusion
""
Write-Host "Conclusion:" -ForegroundColor Cyan
Write-Host "==========="
if ($scsmDllFileExists -and $rsreportserver_configIsCorrect -and $rssrvpolicy_configIsCorrect) {
Write-Host "The selected SSRS instance is configured correctly."
}
else {
Write-Host "The selected SSRS instance is " -NoNewline
Write-Host "*NOT* configured correctly." -ForegroundColor Yellow
Write-Host "Please follow the steps at " -NoNewline
Write-Host "https://learn.microsoft.com/system-center/scsm/config-remote-ssrs" -ForegroundColor Yellow
}
EndScriptExecution
#endregion
后续步骤
- 若要将 AlwaysOn 可用性组与 Service Manager 配合使用以支持故障转移环境,请查看 使用 SQL Server AlwaysOn 可用性组来支持故障转移。