Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Copy-DbaResourceGovernor on GitHub.
Want to see the Bill Of Health for this command? Check out Copy-DbaResourceGovernor.
Copies SQL Server Resource Governor configuration including pools, workload groups, and classifier functions between instances
Migrates your entire SQL Server Resource Governor setup from one instance to another, including custom resource pools, workload groups, and classifier functions. This saves you from manually recreating complex Resource Governor configurations when setting up new servers or during migrations.
The function copies all non-system resource pools (excludes the built-in "internal" and "default" pools) along with their associated workload groups and settings. It also migrates any custom classifier function you've configured to automatically assign incoming requests to appropriate resource pools.
If a resource pool already exists on the destination server, it will be skipped unless you use -Force to overwrite it. Resource Governor will be properly reconfigured after the migration to ensure all changes take effect.
Note that Resource Governor is only available in Enterprise, Datacenter, and Developer editions of SQL Server. The -ResourcePool parameter is auto-populated for command-line completion and can be used to copy only specific objects.
Copy-DbaResourceGovernor
[-Source] <DbaInstanceParameter>
[[-SourceSqlCredential] <PSCredential>]
[-Destination] <DbaInstanceParameter[]>
[[-DestinationSqlCredential] <PSCredential>]
[[-ResourcePool] <Object[]>]
[[-ExcludeResourcePool] <Object[]>]
[-Force]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> Copy-DbaResourceGovernor -Source sqlserver2014a -Destination sqlcluster
Copies all all non-system resource pools from sqlserver2014a to sqlcluster using Windows credentials to connect to the SQL Server instances..
PS C:\> Copy-DbaResourceGovernor -Source sqlserver2014a -Destination sqlcluster -SourceSqlCredential $cred
Copies all all non-system resource pools from sqlserver2014a to sqlcluster using SQL credentials to connect to sqlserver2014a and Windows credentials to connect to sqlcluster.
PS C:\> Copy-DbaResourceGovernor -Source sqlserver2014a -Destination sqlcluster -WhatIf
Shows what would happen if the command were executed.
Specifies the source SQL Server instance containing the Resource Governor configuration to copy. Must have sysadmin privileges and be SQL Server 2008 or later.
Use this to identify which server contains the Resource Governor setup you want to migrate to other instances.
Alias | |
Required | True |
Pipeline | false |
Default Value |
Specifies the destination SQL Server instance(s) where the Resource Governor configuration will be copied. Accepts multiple instances and requires sysadmin privileges on each.
Use this to define which servers should receive the migrated Resource Governor pools, workload groups, and classifier functions.
Alias | |
Required | True |
Pipeline | false |
Default Value |
Provides alternative credentials for connecting to the source SQL Server instance. Accepts PowerShell credential objects from Get-Credential.
Use this when your current Windows credentials don't have access to the source server or when you need to use SQL Server authentication.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Provides alternative credentials for connecting to the destination SQL Server instance(s). Accepts PowerShell credential objects from Get-Credential.
Use this when your current Windows credentials don't have access to the destination servers or when you need to use SQL Server authentication.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Specifies which resource pools to copy by name. Supports tab completion with pools from the source server and accepts multiple pool names.
Use this when you only want to migrate specific resource pools rather than the entire Resource Governor configuration. Excludes system pools (internal, default) automatically.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Specifies which resource pools to skip during the copy operation. Supports tab completion and accepts multiple pool names.
Use this when you want to migrate most of your Resource Governor configuration but exclude certain pools that shouldn't be copied to the destination.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Drops and recreates existing resource pools, workload groups, and classifier functions on the destination server.
Use this when you need to overwrite existing Resource Governor objects that would otherwise be skipped due to name conflicts.
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 |