Download Diagnostic Script
A free, open-source T-SQL script that collects read-only performance telemetry from your SQL Server. Every query is fully inspectable.
v1.0.0 · Pure T-SQL · No installation · No agent · SQL Server 2016-2025
Read-Only
No writes to your server
Fully Inspectable
Read every query before running
Under 60 Seconds
Lightweight, fast collection
2016 - 2025
All editions supported
What Gets Collected
Collected (metadata only)
- ✓ Server configuration (MAXDOP, memory, cost threshold)
- ✓ Wait statistics breakdown
- ✓ Top query text + execution stats (anonymizable)
- ✓ Execution plan XML
- ✓ Missing index recommendations
- ✓ Index usage statistics
- ✓ TempDB, memory, I/O metrics
- ✓ SQL Agent job status
- ✓ SQL Server 2025 features (optimized locking, IQP, etc.)
NEVER Collected
- ✗ Table data or row contents
- ✗ Column values or user data
- ✗ Passwords or connection strings
- ✗ Linked server credentials
- ✗ Database Mail content
- ✗ SQL Agent job step source code
- ✗ Backup file paths or network shares
- ✗ Any personally identifiable information
Quick Start
Set up a read-only login (optional but recommended)
Create a dedicated monitoring login with minimal permissions. Or use an existing login with VIEW SERVER STATE.
-- AutoDBA Read-Only Monitoring Login -- Run this on your SQL Server instance USE [master] GO CREATE LOGIN [AutoDBA_Monitor] WITH PASSWORD = N'YourSecurePassword'; GO GRANT VIEW SERVER STATE TO [AutoDBA_Monitor]; GRANT VIEW ANY DEFINITION TO [AutoDBA_Monitor]; GO -- For each database you want to monitor: -- USE [YourDatabase] -- CREATE USER [AutoDBA_Monitor] FOR LOGIN [AutoDBA_Monitor]; -- GRANT VIEW DATABASE STATE TO [AutoDBA_Monitor]; -- GO
Run the diagnostic script
Open AutoDBA_Collect.sql in SSMS, connect to your instance, and execute. Set parameters at the top of the script to customize collection.
-- In SSMS: Ctrl+T (Results to Text), then F5 to execute -- Or from command line: sqlcmd -S YourServer -d master -i AutoDBA_Collect.sql -o snapshot.json -y 0 -Y 0
Upload the JSON output
Create a free account, add your SQL Server instance, and upload the JSON output. Get your analysis in under 60 seconds.
Privacy Controls
The script includes built-in anonymization. Set @AnonymizeMode at the top of the script.
Full Query Text
Complete query text included for maximum analysis accuracy. Best results.
Anonymized Literals
String and numeric literals replaced with @p placeholders. No PII leakage possible.
Hashed Queries
Query text fully hashed. Only statistics and execution plans retained. Maximum privacy.
Version-Aware Collection
The script auto-detects your SQL Server version and collects version-specific features.
| Version | Additional Collection |
|---|---|
| SQL Server 2016 | Core DMVs, query stats, wait stats, indexes |
| SQL Server 2017 | + Automatic tuning, stats histogram |
| SQL Server 2019 | + Last actual plan, IQP features, memory grant feedback |
| SQL Server 2022 | + Query Store hints, PSPO, ledger status |
| SQL Server 2025 | + Optimized locking, OPPO, DOP/CE feedback, DiskANN indexes, logical index corruption detection, edition limits |
Ready to optimize your SQL Server?
Download the script, run it, upload the output. Get expert-level DBA recommendations in seconds.