Author | Patrick Flynn (@sqllensman) |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Get-DbaCpuRingBuffer on GitHub.
Want to see the Bill Of Health for this command? Check out Get-DbaCpuRingBuffer.
Collects CPU data from sys.dm_os_ring_buffers. Works on SQL Server 2005 and above.
This command is based off of Glen Berry's diagnostic query for average CPU
The sys.dm_os_ring_buffers stores the average CPU utilization history
by the current instance of SQL Server, plus the summed average CPU utilization
by all other processes on your machine are captured in one minute increments
for the past 256 minutes.
Reference: https://www.sqlskills.com/blogs/glenn/sql-server-diagnostic-information-queries-detailed-day-16//
Get-DbaCpuRingBuffer
[-SqlInstance] <DbaInstanceParameter[]>
[[-SqlCredential] <PSCredential>]
[[-CollectionMinutes] <Int32>]
[-EnableException]
[<CommonParameters>]
PS C:\> Get-DbaCpuRingBuffer -SqlInstance sql2008, sqlserver2012
Gets CPU Statistics from sys.dm_os_ring_buffers for servers sql2008 and sqlserver2012 for last 60 minutes.
PS C:\> Get-DbaCpuRingBuffer -SqlInstance sql2008 -CollectionMinutes 240
Gets CPU Statistics from sys.dm_os_ring_buffers for server sql2008 for last 240 minutes
PS C:\> $output = Get-DbaCpuRingBuffer -SqlInstance sql2008 -CollectionMinutes 240 | Select-Object * | ConvertTo-DbaDataTable
Gets CPU Statistics from sys.dm_os_ring_buffers for server sql2008 for last 240 minutes into a Data Table.
PS C:\> 'sql2008','sql2012' | Get-DbaCpuRingBuffer
Gets CPU Statistics from sys.dm_os_ring_buffers for servers sql2008 and sqlserver2012
PS C:\> $cred = Get-Credential sqladmin
PS C:\> Get-DbaCpuRingBuffer -SqlInstance sql2008 -SqlCredential $cred
Connects using sqladmin credential and returns CPU Statistics from sys.dm_os_ring_buffers from sql2008
Allows you to specify a comma separated list of servers to query.
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance. To use:
$cred = Get-Credential, this pass this $cred to the param.
Windows Authentication will be used if DestinationSqlCredential is not specified. To connect as a different Windows user, run PowerShell as that user.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Allows you to specify a Collection Period in Minutes. Default is 60 minutes
Alias | |
Required | False |
Pipeline | false |
Default Value | 60 |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |