commands

^

Set-DbaResourceGovernor

Author John McCall (@lowlydba), https://www.lowlydba.com/
Availability Windows, Linux, macOS

 

Synopsis

Sets the Resource Governor feature on the specified SQL Server to be enabled or disabled, along with specifying an optional classifier function.

Description

In order to utilize Resource Governor, it has to be enabled for an instance and have a classifier function specified. This function toggles the enabled status and sets the classifier function.

Syntax

Set-DbaResourceGovernor
    [-SqlInstance] <DbaInstanceParameter[]>
    [[-Credential] <PSCredential>]
    [-Enabled]
    [-Disabled]
    [[-ClassifierFunction] <String>]
    [-EnableException]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Set-DbaResourceGovernor -SqlInstance sql2016 -Enabled

Sets Resource Governor to enabled for the instance sql2016.

Example: 2
PS C:\> Set-DbaResourceGovernor -SqlInstance sql2012\dev1 -Disabled

Sets Resource Governor to disabled for the instance dev1 on sq2012.

Example: 3
PS C:\> Set-DbaResourceGovernor -SqlInstance sql2012\dev1 -ClassifierFunction 'fnRGClassifier' -Enabled

Sets Resource Governor to enabled for the instance dev1 on sq2012 and sets the classifier function to be 'fnRGClassifier'.

Example: 4
PS C:\> Set-DbaResourceGovernor -SqlInstance sql2012\dev1 -ClassifierFunction 'NULL' -Enabled

Sets Resource Governor to enabled for the instance dev1 on sq2012 and sets the classifier function to be NULL.

Required Parameters

-SqlInstance

The target SQL Server instance or instances.

Alias
Required True
Pipeline true (ByValue)
Default Value

Optional Parameters

-Credential

Credential object used to connect to the Windows server as a different user

Alias
Required False
Pipeline false
Default Value
-Enabled

Enables the Resource Governor.

Alias
Required False
Pipeline false
Default Value False
-Disabled

Disables the Resource Governor.

Alias
Required False
Pipeline false
Default Value False
-ClassifierFunction

Sets the classifier function for Resource Governor.

Alias
Required False
Pipeline false
Default Value
-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

Shows what would happen if the command were to run. No actions are actually performed.

Alias wi
Required False
Pipeline false
Default Value
-Confirm

Prompts you for confirmation before executing any changing operations within the command.

Alias cf
Required False
Pipeline false
Default Value

 

Want to see the source code for this command? Check out Set-DbaResourceGovernor on GitHub.
Want to see the Bill Of Health for this command? Check out Set-DbaResourceGovernor.