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


Clear-DbaSqlConnectionPool

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.

Examples

Clears all local connection pools

Clear-DbaSqlConnectionPool

Clears all connection pools on workstation27

Clear-DbaSqlConnectionPool -ComputerName workstation27

References

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

Get-Help

From PowerShell, execute Get-Help Clear-DbaSqlConnectionPool -Detailed for more information on this function.

Source Code

Want to see the source code? View Clear-DbaSqlConnectionPool.ps1 on GitHub
 

Related commands