此監視器會檢查 Microsoft® SQL Server™ 執行個體服務主體名稱組態的狀態。
此監視器會查看 Microsoft® SQL Server™ 執行個體之服務主體名稱 (SPN) 的組態。其使用方式是比較 SQL Server 服務與網域控制站組態。
Note that the monitor is always in "Healthy" state for non-domain joined machines.
SQL Server Database Engine 的服務主體名稱 (SPN) 可能遺失、錯置或與網域 Active Directory 中設定的其他 SPN 重複。
注意:錯置的 SPN 是指在 Active Directory 中錯誤帳戶上設定的 SPN。
setspn.exe 和 klist.exe 程式可以用來解決此問題。
這兩個工具隨附於 Windows Server 2008 和更新版本中。若為舊版 Windows,您可能必須另外從 Microsoft 下載中心下載這些工具,或透過 Windows 支援工具套件取得這些工具。
案例 1:如何解決遺失的 SPN:
1. 執行下列命令以加入遺失的 SPN:
setspn –S <SPN> <帳戶>
2. 嘗試利用您的用戶端應用程式重新連線到 SQL Server。
也可以在使用 setspn 命令時使用 /S 或 –A 參數。雖然 setspn 命令將會由其他命令所取代,但在舊版 Windows Server (2012、2012 R2) 中仍可使用。
請注意,如果使用虛擬帳戶 (像是本機系統帳戶或 NT Service\MSSQL Server),電腦主機名稱應會顯示 setspn 命令的 <帳戶> 值。
或者,您可以提供適當的權限給 SQL 服務帳戶,讓 SQL 自動產生所需的 SPN。
注意: 缺少 SPN 不一定會導致連線失敗,但會造成應用程式無法使用 Kerberos 驗證。
案例 2: 如何解決錯置的 SPN:
1. 執行下列命令,移除錯置的 SPN:
setspn –D <SPN> <帳戶>
2. 登出用戶端電腦並重新登入,或是執行下列命令以清除 Kerberos 票證快取:
klist purge
3. 嘗試使用您的用戶端應用程式重新連接到 SQL Server。
注意: 如果您想要從應用程式使用 Kerberos,就必須使用上述案例 1 的解決方法設定正確的 SPN。
案例 3: 如何解決重複的 SPN:
1. 找出重複而必須移除的 SPN。
2. 執行下列命令,移除每個重複的 SPN:
setspn –D <SPN> <帳戶>
3. 登出用戶端電腦並重新登入,或是執行下列命令以清除 Kerberos 票證快取:
klist purge
4. 嘗試使用您的用戶端應用程式重新連接到 SQL Server。
如果 SPN 設定不正確,您可能會遇到 SQL Server 的連線問題
名稱 | 描述 | 預設值 |
警示優先程式 | 定義警示優先順序。 | 一般 |
警示嚴重性 | 定義警示嚴重性。 | 警告 |
已啟用 | 啟用或停用該工作流程。 | 是 |
產生警示 | 定義工作流程是否會產生警示。 | 是 |
間隔 (秒) | 執行工作流程的週期性時間間隔 (秒)。 | 900 |
搜尋範圍 | 當搜尋範圍是網域或組織單位時,請使用 LDAP 搜尋。當搜尋範圍是樹系時,可使用通用類別目錄 (GC) 搜尋解析任何磁碟分割內的查詢。值清單: LDAP GC | LDAP |
同步處理時間 | 使用 24 小時制指定的同步處理時間。可以予以省略。 |
|
逾時 (秒) | 指定工作流程在關閉並標記為失敗前所能執行的時間。 | 300 |
Target | Microsoft.SQLServer.2012.DBEngine | ||
Parent Monitor | System.Health.ConfigurationState | ||
Category | AvailabilityHealth | ||
Enabled | True | ||
Alert Generate | True | ||
Alert Severity | Warning | ||
Alert Priority | Normal | ||
Alert Auto Resolve | True | ||
Monitor Type | Microsoft.SQLServer.2012.DBEngine.Configuration.SPNStatus | ||
Remotable | True | ||
Accessibility | Public | ||
Alert Message |
| ||
RunAs | Default |
<UnitMonitor ID="Microsoft.SQLServer.2012.DBEngine.Configuration.SPNStatusMonitor" Accessibility="Public" Enabled="true" Target="SQL2012Core!Microsoft.SQLServer.2012.DBEngine" ParentMonitorID="SystemHealth!System.Health.ConfigurationState" Remotable="true" Priority="Normal" TypeID="Microsoft.SQLServer.2012.DBEngine.Configuration.SPNStatus" ConfirmDelivery="false">
<Category>AvailabilityHealth</Category>
<AlertSettings AlertMessage="Microsoft.SQLServer.2012.DBEngine.Configuration.SPNStatusMonitor.AlertMessage">
<AlertOnState>Warning</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>Warning</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Target/Property[Type="SQL!Microsoft.SQLServer.DBEngine"]/Account$</AlertParameter1>
<AlertParameter2>$Data/Context/Property[@Name='MissingSpnList']$</AlertParameter2>
<AlertParameter3>$Data/Context/Property[@Name='MisplacedSpnList']$</AlertParameter3>
<AlertParameter4>$Data/Context/Property[@Name='DuplicateSpnList']$</AlertParameter4>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Good" MonitorTypeStateID="Good" HealthState="Success"/>
<OperationalState ID="Bad" MonitorTypeStateID="Bad" HealthState="Warning"/>
</OperationalStates>
<Configuration>
<ComputerNetworkName>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerNetworkName>
<NetbiosComputerName>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetbiosComputerName$</NetbiosComputerName>
<InstanceName>$Target/Property[Type="SQL!Microsoft.SQLServer.ServerRole"]/InstanceName$</InstanceName>
<Account>$Target/Property[Type="SQL!Microsoft.SQLServer.DBEngine"]/Account$</Account>
<ServiceName>$Target/Property[Type="SQL!Microsoft.SQLServer.DBEngine"]/ServiceName$</ServiceName>
<IntervalSeconds>900</IntervalSeconds>
<SyncTime/>
<TimeoutSeconds>300</TimeoutSeconds>
<SearchScope>LDAP</SearchScope>
</Configuration>
</UnitMonitor>