Author | Jess Pomfret (@jpomfret), jesspomfret.com |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Test-DbaDbQueryStore on GitHub.
Want to see the Bill Of Health for this command? Check out Test-DbaDbQueryStore.
Compares Query Store settings against best practices.
Evaluates Query Store against a set of rules to match best practices. The rules are:
Test-DbaDbQueryStore
[[-SqlInstance] <DbaInstanceParameter[]>]
[[-SqlCredential] <PSCredential>]
[[-Database] <Object[]>]
[[-ExcludeDatabase] <Object[]>]
[[-InputObject] <Object[]>]
[-EnableException]
[<CommonParameters>]
PS C:\> Test-DbaDbQueryStore -SqlInstance localhost
Checks that Query Store is enabled and meets best practices for all user databases on the localhost machine.
PS C:\> Test-DbaDbQueryStore -SqlInstance localhost -Database AdventureWorks2017
Checks that Query Store is enabled and meets best practices for the AdventureWorks2017 database on the localhost machine.
PS C:\> Test-DbaDbQueryStore -SqlInstance localhost -ExcludeDatabase AdventureWorks2017
Checks that Query Store is enabled and meets best practices for all user databases except AdventureWorks2017 on the localhost machine.
PS C:\> $databases = Get-DbaDatabase -SqlInstance localhost
PS C:\> $databases | Test-DbaDbQueryStore
Checks that Query Store is enabled and meets best practices for all databases that are piped on the localhost machine.
The target SQL Server instance or instances.
Alias | |
Required | False |
Pipeline | false |
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 user 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 |
Enables piped input from Get-DbaDatabase.
Alias | |
Required | False |
Pipeline | true (ByValue) |
Default Value |
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 |