Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Test-DbaDiskSpeed on GitHub.
Want to see the Bill Of Health for this command? Check out Test-DbaDiskSpeed.
Obtains I/O statistics based on the DMV sys.dm_io_virtual_file_stats
Obtains I/O statistics based on the DMV sys.dm_io_virtual_file_stats:
This command uses a query from Rich Benner
https://github.com/RichBenner/PersonalCode/blob/master/Disk_Speed_Check.sql
...and also based on further adaptations referenced at https://github.com/dataplat/dbatools/issues/6551#issue-623216718
Test-DbaDiskSpeed
[-SqlInstance] <DbaInstanceParameter[]>
[[-SqlCredential] <PSCredential>]
[[-Database] <Object[]>]
[[-ExcludeDatabase] <Object[]>]
[[-AggregateBy] <String>]
[-EnableException]
[<CommonParameters>]
PS C:\> Test-DbaDiskSpeed -SqlInstance sql2008, sqlserver2012
Tests how disks are performing on sql2008 and sqlserver2012.
PS C:\> Test-DbaDiskSpeed -SqlInstance sql2008 -Database tempdb
Tests how disks storing tempdb files on sql2008 are performing.
PS C:\> Test-DbaDiskSpeed -SqlInstance sql2008 -AggregateBy "File" -Database tempdb
Returns the statistics aggregated to the file level. This is the default aggregation level if the -AggregateBy param is omitted. The -Database or -ExcludeDatabase params can be used to filter for
specific databases.
PS C:\> Test-DbaDiskSpeed -SqlInstance sql2008 -AggregateBy "Database"
Returns the statistics aggregated to the database/disk level. The -Database or -ExcludeDatabase params can be used to filter for specific databases.
PS C:\> Test-DbaDiskSpeed -SqlInstance sql2008 -AggregateBy "Disk"
Returns the statistics aggregated to the disk level. The -Database or -ExcludeDatabase params can be used to filter for specific databases.
PS C:\> $results = @(instance1, instance2) | Test-DbaDiskSpeed
Returns the statistics for instance1 and instance2 as part of a pipeline command
PS C:\> $databases = @('master', 'model')
$results = Test-DbaDiskSpeed -SqlInstance sql2019 -Database $databases
Returns the statistics for more than one database specified.
PS C:\> $excludedDatabases = @('master', 'model')
$results = Test-DbaDiskSpeed -SqlInstance sql2019 -ExcludeDatabase $excludedDatabases
Returns the statistics for databases other than the exclusions specified.
The target SQL Server instance or instances.
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.
Alias | |
Required | False |
Pipeline | false |
Default Value |
The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.
Alias | |
Required | False |
Pipeline | false |
Default Value |
The database(s) to exclude - this list is auto-populated from the server
Alias | |
Required | False |
Pipeline | false |
Default Value |
Specify the level of aggregation for the statistics. The available options are 'File' (the default), 'Database', and 'Disk'.
Alias | |
Required | False |
Pipeline | false |
Default Value | File |
Accepted Values | Database,Disk,File |
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 |