Author | Enrico van de Laar (@evdlaar) , Tracy Boggiano (@Tracy Boggiano) |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Copy-DbaDbQueryStoreOption on GitHub.
Want to see the Bill Of Health for this command? Check out Copy-DbaDbQueryStoreOption.
Copies the configuration of a Query Store enabled database and sets the copied configuration on other databases.
Copies the configuration of a Query Store enabled database and sets the copied configuration on other databases.
Copy-DbaDbQueryStoreOption
[-Source] <DbaInstanceParameter>
[[-SourceSqlCredential] <PSCredential>]
[-SourceDatabase] <Object>
[-Destination] <DbaInstanceParameter[]>
[[-DestinationSqlCredential] <PSCredential>]
[[-DestinationDatabase] <Object[]>]
[[-Exclude] <Object[]>]
[-AllDatabases]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> Copy-DbaDbQueryStoreOption -Source ServerA\SQL -SourceDatabase AdventureWorks -Destination ServerB\SQL -AllDatabases
Copy the Query Store configuration of the AdventureWorks database in the ServerA\SQL instance and apply it on all user databases in the ServerB\SQL Instance.
PS C:\> Copy-DbaDbQueryStoreOption -Source ServerA\SQL -SourceDatabase AdventureWorks -Destination ServerB\SQL -DestinationDatabase WorldWideTraders
Copy the Query Store configuration of the AdventureWorks database in the ServerA\SQL instance and apply it to the WorldWideTraders database in the ServerB\SQL Instance.
Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2016 or higher.
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
Specifies the database to copy the Query Store configuration from.
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2016 or higher.
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 |
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 |
Specifies a list of databases that will receive a copy of the Query Store configuration of the SourceDatabase.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Specifies a list of databases which will NOT receive a copy of the Query Store configuration.
Alias | |
Required | False |
Pipeline | false |
Default Value |
If this switch is enabled, the Query Store configuration will be copied to all databases on the destination instance.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
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 |
If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |