commands

^

Copy-DbaDbQueryStoreOption

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.

Synopsis

Copies the configuration of a Query Store enabled database and sets the copied configuration on other databases.

Description

Copies the configuration of a Query Store enabled database and sets the copied configuration on other databases.

Syntax

Copy-DbaDbQueryStoreOption
    [-Source] <DbaInstanceParameter>
    [[-SourceSqlCredential] <PSCredential>]
    [-SourceDatabase] <Object>
    [-Destination] <DbaInstanceParameter[]>
    [[-DestinationSqlCredential] <PSCredential>]
    [[-DestinationDatabase] <Object[]>]
    [[-Exclude] <Object[]>]
    [-AllDatabases]
    [-EnableException]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

 

Examples

 

Example: 1
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.

Example: 2
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.

Required Parameters

-Source

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
-SourceDatabase

Specifies the database to copy the Query Store configuration from.

Alias
Required True
Pipeline true (ByValue)
Default Value
-Destination

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

Optional Parameters

-SourceSqlCredential

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
-DestinationSqlCredential

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
-DestinationDatabase

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
-Exclude

Specifies a list of databases which will NOT receive a copy of the Query Store configuration.

Alias
Required False
Pipeline false
Default Value
-AllDatabases

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
-EnableException

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
-WhatIf

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
-Confirm

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