For those who don’t know about it, sp_WhoIsActive is a stored procedure that provides detailed information about the sessions running on your SQL Server instance.
It is a great tool when we need to troubleshoot some problems such as long-running queries or blocking. (just two examples)
This stored procedure works on any version/edition since SQL Server 2005 SP1. Although, you only will be able to see the new feature (live query plans) if you run it on SQL Server 2016 or 2017.
You can read the release notes on the download page.
Thank you, Adam Machanic!
The show off part
Using the dbatools open source PowerShell module I can deploy the new latest version of the stored procedure.
By running the following two lines of code, I updated my
sp_WhoIsActive to the latest version (we always download the newest one) on my 123 instances in less than one minute (to be precise, in 51,717 seconds).
$SQLServers = Invoke-DbaQuery -SqlInstance "CentralServerName" -Query "SELECT InstanceConnection FROM CentralDB.dbo.Instances" | Select-Object -ExpandProperty InstanceConnection Install-DbaWhoIsActive -SqlInstance $SQLServers -Database master
The first line will retrieve from my central database all my instances’ connection string.
The second one will download the latest version, and compile the stored procedure on the master database on each of the instances in that list (123 instances).
Thanks for reading