效能計數器收集器型別
您可以使用效能計數器收集器型別,從執行 SQL Server 2008 的電腦中收集特定的效能計數器資訊。之後,您就可以使用這項資料當做疑難排解或容量規劃的基準。這個收集器型別會在 core.supported_collector_types 檢視表中註冊。
這個收集器型別具有下列輸入參數:
物件。在 SQL Server 執行個體中執行的 SQL Server 物件。
計數器。與 SQL Server 物件有關聯的計數器。
執行個體。指定之物件的執行個體。
如需有關物件和計數器的詳細資訊,請參閱<使用 SQL Server 物件>。
[!附註]
某些輸入參數支援萬用字元,可讓您將多個計數器併入一個陳述式。不過,萬用字元的支援有所限制。您無法在物件層級中使用萬用字元。在計數器和執行個體層級中,只支援字串開頭的萬用字元 (例如 '* Processor') 或字串結尾的萬用字元 (例如 'Memory *')。
效能計數器輸入結構描述
效能計數器收集器型別會使用輸入參數的下列結構描述。
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="DataCollectorType">
<xs:element name="PerformanceCountersCollector">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="PerformanceCounters">
<xs:complexType>
<xs:attribute name="Objects" type="xs:string" use="required" />
<xs:attribute name="Counters" type="xs:string" use="required" />
<xs:attribute name="Instances" type="xs:string" use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="StoreLocalizedCounterNames" type="xs:boolean" use="optional" default="false" />
</xs:complexType>
</xs:element>
</xs:schema>
下列程式碼範例會示範如何使用此結構描述。
<ns:PerformanceCountersCollector xmlns:ns="DataCollectorType">
<PerformanceCounters
Objects="SQLServer:Locks"
Counters="Lock *"
Instances="_Total"
/>
<PerformanceCounters
Objects="SQLServer:SQL Statistics"
Counters="*/sec"
/>
<PerformanceCounters
Objects="Processor"
Counters="% Processor Time"
Instances="*"
/>
</ns:PerformanceCountersCollector>
這則範例將會為要針對 SQLServer:Locks 物件擷取的 "_Total" 執行個體產生計數器 (具有以 "Lock" 為開頭的名稱)。它也會針對 SQLServer:SQLStatistics 物件擷取所有以 "/sec" 結尾之計數器的所有執行個體。最後,它將針對 Processor 物件的所有執行個體擷取 "% Processor Time" 計數器。
處理和輸出
效能計數器收集器型別會使用資料收集器所提供的收集和上載封裝。此收集器型別取決於用來查詢以及從效能計數器取得資料的效能資料協助程式 API。如需詳細資訊,請參閱 MSDN 上的<使用效能資料協助程式程式庫>(英文)。
當資料收集完成時,資料收集器會將資料大量上載到管理資料倉儲內的 snapshots.performance_counters 檢視表。如需詳細資訊,請參閱<管理資料倉儲>。
變更記錄
更新的內容 |
---|
更正效能計數器收集器型別的輸入結構描述。 |
更正示範如何使用此結構描述的程式碼範例。 |