設定 SQL Server Reporting Services 的手動步驟
在部署 Service Manager 資料倉儲管理伺服器期間,您可以指定將部署MICROSOFT SQL Server Reporting Services (SSRS) 的伺服器。 依預設,安裝過程中會選取裝載資料倉儲管理伺服器的電腦。 如果您指定要裝載 SSRS 的不同電腦,系統會提示您遵循此程式來準備伺服器。 準備遠端電腦來裝載 SSRS 涉及下列步驟,本節將詳細說明這些步驟:
將 Microsoft.EnterpriseManagement.Reporting.Code.dll 從 Service Manager 安裝媒體複製到裝載 SSRS 的電腦上。
在裝載 SSRS 的電腦上,將程式碼片段新增到 rssrvpolicy 設定檔中。
將 Extension 標記新增到同一部電腦上 rsreportserver 設定檔中的現有 Data 區段。
如果您使用 SQL Server 的預設實例,請使用 Windows 檔案總管將 Microsoft.EnterpriseManagement.Reporting.Code.dll 拖曳至 \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 數據倉儲中,觀察到下列已知問題:
如果 SQL Server Reporting Services (SSRS) 在數據倉儲管理伺服器上本機執行,且 SSRS 是 2017 或更新版本,數據倉儲安裝程式就會順利完成,但可能無法正確設定指定的本機 SSRS 實例。
使用下列腳本來確認本機 SSRS 安裝是否已正確設定,並可搭配 Service Manager 數據倉儲使用。
注意
此 PowerShell 腳本可以在 Service Manager 數據倉儲安裝之後執行。 腳本不會對組態進行任何變更,但會加以驗證。 您可以視需要執行文稿多次。
#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
下一步
- 若要搭配 Service Manager 使用 AlwaysOn 可用性群組來支援故障轉移環境,請檢閱 使用 SQL Server AlwaysOn 可用性群組來支援故障轉移。