commands

^

Clear-DbaConnectionPool

Author Chrissy LeMaire (@cl), netnerds.net
Availability Windows only

 

Synopsis

Resets (or empties) the connection pool.

Description

This command resets (or empties) the connection pool.

If there are connections in use at the time of the call, they are marked appropriately and will be discarded (instead of being returned to the pool) when Close() is called on them.

Ref: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.clearallpools(v=vs.110).aspx

Syntax

Clear-DbaConnectionPool
    [[-ComputerName] <DbaInstanceParameter[]>]
    [[-Credential] <PSCredential>]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Clear-DbaConnectionPool

Clears all local connection pools.

Example: 2
PS C:\> Clear-DbaConnectionPool -ComputerName workstation27

Clears all connection pools on workstation27.

Optional Parameters

-ComputerName

Target computer(s). If no computer name is specified, the local computer is targeted.

Alias cn,host,Server
Required False
Pipeline true (ByValue)
Default Value $env:COMPUTERNAME
-Credential

Alternate credential object to use for accessing the target computer(s).

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

 

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