Origine dati ricompilazione SQL 2016
Microsoft.SQLServer.2016.DBEngine.SQLReCompilation.DataSource (DataSourceModuleType)
Origine dati ricompilazione SQL
Element properties:
Member Modules:
Overrideable Parameters:
Source Code:
<DataSourceModuleType ID="Microsoft.SQLServer.2016.DBEngine.SQLReCompilation.DataSource" Accessibility="Internal">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="IntervalSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TimeoutSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="SyncTime" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="PerformanceCounterObject" type="xsd:string"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
<OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string"/>
</OverrideableParameters>
<ModuleImplementation>
<Composite>
<MemberModules>
<DataSource ID="Scheduler" TypeID="System!System.Scheduler">
<Scheduler>
<SimpleReccuringSchedule>
<Interval>$Config/IntervalSeconds$</Interval>
<SyncTime>$Config/SyncTime$</SyncTime>
</SimpleReccuringSchedule>
<ExcludeDates/>
</Scheduler>
</DataSource>
<ProbeAction ID="PS" TypeID="Windows!Microsoft.Windows.PowerShellPropertyBagProbe">
<ScriptName>SQLReCompilation.ps1</ScriptName>
<ScriptBody><Script>param($PerformanceCounterObject)
$SCRIPT_EVENT_ID = 4211
#debug
$DEBUG_MODE = 0
#Event Severity values
$INFORMATION_EVENT_TYPE = 0
$ERROR_EVENT_TYPE = 1
$ManagementGroupID = '$Target/ManagementGroup/Id$'
function Main()
{
#
# Prepare MOM API and property bag object
#
$api = New-Object -comObject "MOM.ScriptAPI"
$bag = $api.CreatePropertyBag()
$msg = [Environment]::NewLine
$err = [Environment]::NewLine
#try...catch was removed in order to not spam to event log if there is something wrong with perf. counters
$compilations = (Get-Counter ("\" + $PerformanceCounterObject + ":SQL Statistics\SQL Compilations/sec")).CounterSamples[0].CookedValue
$recompilations = (Get-Counter ("\" + $PerformanceCounterObject + ":SQL Statistics\SQL Re-Compilations/sec")).CounterSamples[0].CookedValue
[double]$recompilationPercent = 0.0
if(($compilations -gt 0) -and ($recompilations -gt 0))
{
$recompilationPercent = 100.0 * $recompilations / $compilations
}
$bag.AddValue("RecompilationPercent", $recompilationPercent)
$msg += "RecompilationPercent=$recompilationPercent"
$msg += [Environment]::NewLine
if($DEBUG_MODE -eq 1){
$api.LogScriptEvent("SQL Recompilation data source", $SCRIPT_EVENT_ID, $INFORMATION_EVENT_TYPE, $msg + $err)
}
$bag
}
#SQL2016Constants.ps1
$MANAGEMENT_PACK_VERSION = "7.0.15.0"
$ManagementGroupName = '$Target/ManagementGroup/Name$'
$ManagementGroupID = '$Target/ManagementGroup/Id$'
Main
</Script></ScriptBody>
<SnapIns/>
<Parameters>
<Parameter>
<Name>PerformanceCounterObject</Name>
<Value>$Config/PerformanceCounterObject$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<StrictErrorHandling>true</StrictErrorHandling>
</ProbeAction>
</MemberModules>
<Composition>
<Node ID="PS">
<Node ID="Scheduler"/>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
</DataSourceModuleType>