DEV.co
Open-Source Databases · amachanic

sp_whoisactive

sp_WhoIsActive is a SQL Server stored procedure for real-time activity monitoring across SQL Server 2005–2022 and Azure SQL DB. It provides detailed visibility into running queries, locks, and resource usage through a single T-SQL script installation.

Source: GitHub — github.com/amachanic/sp_whoisactive
1.4k
GitHub stars
339
Forks
TSQL
Primary language
GPL-3.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryamachanic/sp_whoisactive
Owneramachanic
Primary languageTSQL
LicenseGPL-3.0 — OSI-approved
Stars1.4k
Forks339
Open issues19
Latest release20260409 (2026-04-10)
Last updated2026-05-16
Sourcehttps://github.com/amachanic/sp_whoisactive

What sp_whoisactive is

A T-SQL stored procedure that captures session-level activity metadata including query execution, blocking chains, and resource consumption. Supports multiple SQL Server versions via versioned script folders (2008, 2019, current) and uses semantic versioning tied to minimum/maximum supported SQL Server releases.

Quickstart

Get the sp_whoisactive source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/amachanic/sp_whoisactive.gitcd sp_whoisactive# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Real-time SQL Server Performance Monitoring

Quickly identify running queries, blocking sessions, and resource bottlenecks without external tools or agents.

On-premise and Hybrid SQL Server Environments

Works across legacy (2005+) and modern SQL Server versions, plus Azure SQL DB, making it ideal for organizations with mixed infrastructure.

Incident Triage and Troubleshooting

DBA teams can rapidly diagnose query hangs, deadlocks, and performance degradation during operational incidents.

Implementation considerations

  • Execute sp_WhoIsActive.sql in SQL Server Management Studio against the target database (or master for instance-wide access); no external deployment infrastructure required.
  • Version selection is critical: use 2008/ folder for SQL 2008 R2 and earlier, 2019/ for 2012–2019, root folder for 2022+ and future versions.
  • Script installs as a stored procedure; verify permissions and schema placement (dbo. vs. custom schema) before production deployment.
  • Running the procedure consumes minimal CPU; test impact on busy instances, particularly when capturing full query plans or large result sets.
  • Output can be captured to a table for post-analysis or piped to monitoring/logging systems via PowerShell or T-SQL jobs.

When to avoid it — and what to weigh

  • Proprietary Closed-Source Requirements — GPLv3 license requires derivative works and integrations to remain open-source; not compatible with closed-source commercial products without legal review.
  • Need for Third-Party Commercial Support — Community-maintained project with no formal SLA or vendor support; relies on GitHub issues and maintainer goodwill.
  • Centralized Multi-Instance Monitoring Dashboard — Designed as a single-instance stored procedure; does not provide built-in aggregation, alerting, or UI for managing many SQL Server instances.
  • Automated Long-term Historical Trending — Point-in-time activity snapshot tool; does not retain or visualize metrics over time without external scripting or tooling.

License & commercial use

GPLv3 (GNU General Public License v3.0). Code is open-source and freely available. Derivative works, modifications, and distributions must remain open-source under GPLv3.

GPLv3 permits internal commercial use (e.g., running the procedure for your own monitoring). However, if you modify the script or integrate it into a proprietary product for resale/distribution, you must open-source those additions and distribute under GPLv3. Do not assume you can ship this in a closed-source commercial monitoring tool without legal review.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

Requires SQL Server login with permission to execute procedures and query system views; typical DBA role. No inherent code injection vulnerabilities reported, but users should review the T-SQL source and audit execution context. GPLv3 source is publicly auditable. No built-in authentication, encryption, or role-based output filtering; restrict execution to trusted administrators.

Alternatives to consider

SQL Server Management Studio Activity Monitor

Native, built-in GUI for basic session monitoring; requires no installation but less granular control and scripting integration than sp_WhoIsActive.

Extended Events (XE)

Microsoft's modern event tracing engine for deep diagnostics; more flexible and lower overhead but steeper learning curve and requires separate capture/analysis tooling.

Third-party SaaS monitoring (e.g., SolarWinds DPA, Redgate SQL Monitor)

Commercial, vendor-supported solutions with dashboards, alerting, and multi-instance aggregation; require licensing and ongoing fees but eliminate GPL compliance burden.

Software development agency

Build on sp_whoisactive with DEV.co software developers

Ensure your team understands GPLv3 compliance, test the script in a non-prod environment matching your SQL Server version, and plan integration with your existing monitoring and alerting workflows.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

sp_whoisactive FAQ

Can I use sp_WhoIsActive in a commercial product?
Internal use (e.g., monitoring your own databases) is fine. If you modify the script or embed it in software you sell or distribute, the entire product must be open-source under GPLv3. Consult legal counsel if uncertain.
Which SQL Server versions are supported?
Current version supports 2022 and newer. For 2012–2019, use the 2019/ folder script. For 2008 R2 and earlier, use 2008/ folder. Always match your SQL version to the appropriate script version.
Does it work with Azure SQL DB?
Yes, according to the README. However, Azure SQL DB may have permission and SQL Agent limitations; test in your environment and verify that required system views and permissions are available.
What happens if I run it on a production instance?
The procedure itself is designed to be lightweight. Test on a non-prod instance first, then monitor CPU and I/O impact on production. Most DBAs run it ad hoc during troubleshooting; you can also schedule it as a job to capture snapshots.

Work with a software development agency

Need help beyond evaluating sp_whoisactive? DEV.co is a software development agency offering software development services and web development for teams of every size. Our software developers and web developers build custom software, web applications, APIs, and open-source databases integrations — and maintain them long-term.

Ready to integrate sp_WhoIsActive?

Ensure your team understands GPLv3 compliance, test the script in a non-prod environment matching your SQL Server version, and plan integration with your existing monitoring and alerting workflows.