Windows SBS 控制台窗口小型商业服务器 2008 年可能会崩溃,对于其他警报,显示"不可用"或需要很长时间才能显示的安全和其他警报状态

适用于: Microsoft Windows Small Business ServerWindows Small Business Server 2008 StandardWindows Small Business Server 2008 Premium

症状


Windows SBS 控制台窗口小型商业服务器 2008 年可能会显示一个或多个以下症状。

症状 1

不可用的状态将显示在其他警报主页页的网络重点摘要部分下。

症状

在 Console.log 文件中记录类似于以下异常:
[5164] 090620.094247.9164: Exception: --------------------------------------- An exception of type 'Type: System.Data.SqlClient.SqlException, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' has occurred. Timestamp: 06/20/2009 09:42:47 Message: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. Stack:    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)                    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)                    at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)                    at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()                    at System.Data.SqlClient.SqlDataReader.get_MetaData()                    at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)                    at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)                    at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)                    at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)                    at System.Data.SqlClient.SqlCommand.ExecuteScalar()                    at Microsoft.WindowsServerSolutions.SystemHealth.Monitoring.MonitoringSQLDataStore.GetAlertCountPerType(ComputerType type)  

现象 3

之后很长时间,状态显示安全其他警报主页页的网络重点摘要部分下。

故障现象 4

之后很长时间的值显示在安全状态列和网络页的计算机选项卡上的其他警报列中。

症状 5

当您尝试手动生成报告的报告选项卡上时,Windows SBS 控制台可能会崩溃,如果选择了安全复选框添加到报表的安全内容。

原因


此问题是由于监视数据库是非常大。 Windows SBS 控制台无法快速查询监视数据库。

解决方案


若要解决此问题,请运行下面的 Windows PowerShell 脚本。 此脚本通过减少 30 天到 90 天内从保留的历史数据来减少监视数据库中的历史数据。 此外,该脚本创建用于运行速度更快的查询的索引。若要运行此脚本,请执行以下步骤:
  1. 单击开始,在搜索框中,键入记事本,然后单击记事本,在搜索结果中。
  2. 复制并粘贴到记事本下面的脚本:
    cls;############################################################################ SQL Scripts#########################################################################$sqlScript = @"USE [SBSMonitoring]BEGIN TRAN T1UPDATE [SBSMonitoring].[dbo].[Settings] SET [Value] = 30 WHERE [Name] = 'CleanupPeriod'COMMIT TRAN T1SELECT N'Set CleanupPeriod to 30 days'EXECUTE [SBSMonitoring].[dbo].[CleanupDatabase]SELECT N'CleanupDatabase job done.'-- Create IndexesIF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[WMICollectedData]') AND name = N'_SBS_BLOG_index_WMICollectedData_5_K4_K1_K5_2')DROP INDEX [_SBS_BLOG_index_WMICollectedData_5_K4_K1_K5_2] ON [dbo].[WMICollectedData] WITH ( ONLINE = OFF )CREATE NONCLUSTERED INDEX [_SBS_BLOG_index_WMICollectedData_5_K4_K1_K5_2] ON [dbo].[WMICollectedData] ([WMIPropertyID] ASC,[ID] ASC, [WMIInstanceID] ASC) INCLUDE ( [DateCollected]) WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY]SELECT N'Succeeded to create index _SBS_BLOG_index_WMICollectedData_5_K4_K1_K5_2'IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[Reports]') AND name = N'_SBS_BLOG_index_Reports_5_K2_K3_1_4')DROP INDEX [_SBS_BLOG_index_Reports_5_K2_K3_1_4] ON [dbo].[Reports] WITH ( ONLINE = OFF )CREATE NONCLUSTERED INDEX [_SBS_BLOG_index_Reports_5_K2_K3_1_4] ON [dbo].[Reports] ([ConfigurationID] ASC, [DateGenerated] ASC) INCLUDE ([ID], [Data]) WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY]SELECT N'Succeeded to create index _SBS_BLOG_index_Reports_5_K2_K3_1_4'IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[WMICollectedData]') AND name = N'_SBS_BLOG_index_WMICollectedData_5_K2D_K4_K5')DROP INDEX [_SBS_BLOG_index_WMICollectedData_5_K2D_K4_K5] ON [dbo].[WMICollectedData] WITH ( ONLINE = OFF )CREATE NONCLUSTERED INDEX [_SBS_BLOG_index_WMICollectedData_5_K2D_K4_K5] ON [dbo].[WMICollectedData] ([DateCollected] DESC, [WMIPropertyID] ASC, [WMIInstanceID] ASC) WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY]SELECT N'Succeeded to create index _SBS_BLOG_index_WMICollectedData_5_K2D_K4_K5'IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[Alerts]') AND name = N'_SBS_BLOG_index_Alerts_8_7_')DROP INDEX [_SBS_BLOG_index_Alerts_8_7_] ON [dbo].[Alerts] WITH ( ONLINE = OFF )CREATE INDEX [_SBS_BLOG_index_Alerts_8_7_] ON [SBSMonitoring].[dbo].[Alerts] ([DefinitionID], [ComputerID]) INCLUDE ([DateOccured])SELECT N'Succeeded to create index _SBS_BLOG_index_Alerts_8_7_'-- Create StatisticsIF EXISTS (SELECT * FROM sys.stats WHERE object_id = OBJECT_ID(N'[dbo].[WMICollectedData]') AND name = N'_SBS_BLOG_stat_WMICollectedData_5_1_4')DROP STATISTICS [dbo].[WMICollectedData].[_SBS_BLOG_stat_WMICollectedData_5_1_4]CREATE STATISTICS [_SBS_BLOG_stat_WMICollectedData_5_1_4] ON [dbo].[WMICollectedData]([WMIInstanceID], [ID], [WMIPropertyID])SELECT N'Succeeded to create statistics _SBS_BLOG_stat_WMICollectedData_5_1_4'IF EXISTS (SELECT * FROM sys.stats WHERE object_id = OBJECT_ID(N'[dbo].[WMICollectedData]') AND name = N'_SBS_BLOG_dta_stat_WMICollectedData_4_1_5_2_3')DROP STATISTICS [dbo].[WMICollectedData].[_SBS_BLOG_dta_stat_WMICollectedData_4_1_5_2_3]CREATE STATISTICS [_SBS_BLOG_dta_stat_WMICollectedData_4_1_5_2_3] ON [dbo].[WMICollectedData]([WMIPropertyID], [ID], [WMIInstanceID], [DateCollected], [StatusID])SELECT N'Succeeded to create statistics _SBS_BLOG_dta_stat_WMICollectedData_4_1_5_2_3'IF EXISTS (SELECT * FROM sys.stats WHERE object_id = OBJECT_ID(N'[dbo].[WMICollectedData]') AND name = N'_SBS_BLOG_dta_stat_WMICollectedData_5_1_3_4')DROP STATISTICS [dbo].[WMICollectedData].[_SBS_BLOG_dta_stat_WMICollectedData_5_1_3_4]CREATE STATISTICS [_SBS_BLOG_dta_stat_WMICollectedData_5_1_3_4] ON [dbo].[WMICollectedData]([WMIInstanceID], [ID], [StatusID], [WMIPropertyID])SELECT N'Succeeded to create statistics _SBS_BLOG_dta_stat_WMICollectedData_5_1_3_4'IF EXISTS (SELECT * FROM sys.stats WHERE object_id = OBJECT_ID(N'[dbo].[WMICollectedData]') AND name = N'_SBS_BLOG_dta_stat_WMICollectedData_5_4_2')DROP STATISTICS [dbo].[WMICollectedData].[_SBS_BLOG_dta_stat_WMICollectedData_5_4_2]CREATE STATISTICS [_SBS_BLOG_dta_stat_WMICollectedData_5_4_2] ON [dbo].[WMICollectedData]([WMIInstanceID], [WMIPropertyID], [DateCollected])SELECT N'Succeeded to create statistics _SBS_BLOG_dta_stat_WMICollectedData_5_4_2'IF EXISTS (SELECT * FROM sys.stats WHERE object_id = OBJECT_ID(N'[dbo].[WMICollectedData]') AND name = N'_SBS_BLOG_stat_WMICollectedData_2_1_5')DROP STATISTICS [dbo].[WMICollectedData].[_SBS_BLOG_stat_WMICollectedData_2_1_5]CREATE STATISTICS [_SBS_BLOG_stat_WMICollectedData_2_1_5] ON [dbo].[WMICollectedData]([DateCollected], [ID], [WMIInstanceID])SELECT N'Succeeded to create statistics _SBS_BLOG_stat_WMICollectedData_2_1_5'IF EXISTS (SELECT * FROM sys.stats WHERE object_id = OBJECT_ID(N'[dbo].[WMICollectedData]') AND name = N'_SBS_BLOG_stat_WMICollectedData_1_3_5_2')DROP STATISTICS [dbo].[WMICollectedData].[_SBS_BLOG_stat_WMICollectedData_1_3_5_2]CREATE STATISTICS [_SBS_BLOG_stat_WMICollectedData_1_3_5_2] ON [dbo].[WMICollectedData]([ID], [StatusID], [WMIInstanceID], [DateCollected])SELECT N'Succeeded to create statistics _SBS_BLOG_stat_WMICollectedData_1_3_5_2'"@;$userInput = Read-Host -Prompt @"Before running this script, follow the instructions in the Knowledge Base article 981939 to back up your database files.  If you are ready to run the script, type the letter 'Y' to confirm that you have backed up the database, and then press 'Enter'. "@;if([System.String]::Compare($userInput, "Y", $true) -ne 0){exit;}################################################################################## Save the sql file to temp folder###############################################################################$sqlFile = [System.IO.Path]::Combine($Env:TEMP, "UpdateSBSMonitoring.sql");$sqlScript | Out-File -FilePath "$sqlFile" -Force;################################################################################## Get SBS2008 log folder###############################################################################$regKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WSSG";$regVal = "ProductLogDir";$sqlLogPath =[System.Environment]::ExpandEnvironmentVariables([Microsoft.Win32.Registry]::GetValue($regKey, $regVal, $null));if([System.String]::IsNullOrEmpty($sqlLogPath)){$sqlLogPath = $Env:TEMP;}$dateTime = Get-Date;$sqlLogFile = "UpdateSBSMonitoring_{1}_{0:HH}{0:mm}{0:ss}.log" -f $dateTime, $dateTime.ToShortDateString().Replace('/', '_');$sqlLogFile = [System.IO.Path]::Combine($sqlLogPath, $sqlLogFile);################################################################################## Call " SqlCmd " to execute the sql script###############################################################################$cmdPara = " -S $Env:COMPUTERNAME\SBSMonitoring -E -i `"$sqlFile`"";Write-Host ("Sqlcmd" + $cmdPara);$processStartInfo = New-Object System.Diagnostics.ProcessStartInfo("Sqlcmd", $cmdPara);$processStartInfo.UseShellExecute = $false;$processStartInfo.ErrorDialog = $true;$processStartInfo.CreateNoWindow = $true;$processStartInfo.RedirectStandardOutput = $true;$processStartInfo.RedirectStandardError = $true;$process = [System.Diagnostics.Process]::Start($processStartInfo);$startTime = [System.DateTime]::Now;$process.WaitForExit(); $finishTime = [System.DateTime]::Now;$stdOutput = $process.StandardOutput.ReadToEnd();$errOutput = $process.StandardError.ReadToEnd();if($process.ExitCode -eq 0 -and $errOutput.Length -eq 0){Write-Host $stdOutput;Write-Host "The script ran successfully."}else{Write-Host $stdOutput;Write-Host $errOutput;Write-Host "An error occurred while running the script. For details about this error, see the log file at $sqlLogFile.";}[System.String]::Join([System.Environment]::NewLine, `(("Sqlcmd" + $cmdPara), `("Started at: " + $startTime), `("Finished at:" + $finishTime), `"Standard Output: ", $stdOutput, `"Error Output: ", $errOutput))| Out-File $sqlLogFile -Force;
  3. 通过使用以下文件名保存该文件:
    KB981939.ps1.
    回答 5: 适用于 Windows Server 2016 和 Windows 10 版本 1709 的 Windows Server 容器映像的更新包含针对这组漏洞的缓解措施,不需要进行额外的配置。 我们建议您将文件保存到您可以轻松访问的位置。 例如,将文件保存到C:\windows\temp文件夹。
  4. 监视数据库文件进行备份。 为此,请按照下列步骤操作:
    1. 单击开始,在搜索框中,键入Services.msc 服务在搜索结果中,用鼠标右键单击,然后单击以管理员身份运行
      UAC 如果提示您输入管理员密码或进行确认,请键入密码,或提供确认。
    2. 找到该SQL Server (SBSMONITORING)服务。
    3. SQL Server (SBSMONITORING)服务中,用鼠标右键单击,然后单击停止
    4. 备份以下文件夹中的文件:
      C:\Program 文件 (x86) \Microsot SQL Server\MSSQL.1\MSSQL\Data
    5. SQL Server (SBSMONITORING)服务中,用鼠标右键单击,然后单击开始
  5. 单击开始,请在搜索框中,键入PowerShell在搜索结果中中, 右击Windows PowerShell 模块,然后单击以管理员身份运行
    UAC 如果提示您输入管理员密码或进行确认,请键入密码,或提供确认。
  6. Windows PowerShell 模块窗口中的当前目录更改到 KB981939.ps1 文件的保存的位置。
  7. 键入以下命令来运行 Windows PowerShell 脚本,,然后按 enter 键:
    .\kb981939.ps1
    回答 5: 适用于 Windows Server 2016 和 Windows 10 版本 1709 的 Windows Server 容器映像的更新包含针对这组漏洞的缓解措施,不需要进行额外的配置。 您必须配置 Windows PowerShell 执行策略以允许在运行此命令之前运行的脚本。 否则,当您运行命令时收到以下错误消息:
    无法加载文件 C:\KB981939.ps1,因为在此系统上禁用了脚本的执行。 请"获取帮助 about_signing"的更多详细信息,参阅。
    有关如何配置 Windows PowerShell 执行策略的详细信息,请访问下面的 Microsoft TechNet 网站:
  8. 当您收到以下消息时,请键入Y :
    之前运行此脚本,请按照知识库文章 981939t 中的说明进行操作,备份数据库文件。
    如果您准备好运行该脚本时,键入字母 Y 确认您已备份数据库,然后按 Enter。
    回答 5: 适用于 Windows Server 2016 和 Windows 10 版本 1709 的 Windows Server 容器映像的更新包含针对这组漏洞的缓解措施,不需要进行额外的配置。 如果监视数据库很大,为 10 分钟或更长的时间,可能会运行该脚本。如果该脚本没有成功运行,您必须监视数据库文件的备份进行还原。

参考


有关此问题的详细信息,请访问以下 TechNet 网站: