dbatools is a free PowerShell module with over 180 SQL Server administration, best practice and migration commands included.


Copy-DbaQueryStoreConfig

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

Screenshots

Examples

To 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.

Copy-DbaQueryStoreConfig -Source ServerA\SQL -SourceDatabase AdventureWorks -Destination ServerB\SQL -AllDatabases

To 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.

Copy-DbaQueryStoreConfig -Source ServerA\SQL -SourceDatabase AdventureWorks -Destination ServerB\SQL -DestinationDatabase WorldWideTraders

Author

This command was created by Enrico van de Laar. You can follow Enrico on Twitter at @evdlaar.

Get-Help

From PowerShell, execute Get-Help Copy-DbaQueryStoreConfig -Detailed for more information on this function.

Source Code

Want to see the source code? View Copy-DbaQueryStoreConfig.ps1 on GitHub
 

Related commands