SQL Server DBA Scripts & Tools
dba-tools is the toolkit I use as a working SQL Server DBA, free and open on GitHub. Copy/paste scripts for the day-to-day, a one-command health check, and an AI assessment that reviews the whole server with you.
Quick access
What do you need right now?
What’s Inside
Eight areas, each one a hub with the scripts and the write-ups behind them.
How Deep Do You Need to Go?
Stopping at the first one is a perfectly good answer.
Copy/Paste First
184 SQL scripts, 177 of them read-only, documented across 145 pages here. Open one, paste it into SSMS, run it. No install, no parameters, no magic variables.
Health Check
45 diagnostic scripts run in a single command, saved as CSVs, then a rules review flags CRITICAL / WARNING / INFO findings.
AI Assessment
An AI reads the whole collection, correlates findings into root causes, and writes a prioritized report.
Clone it, run one command
Setup, for the second and thirdA single script needs nothing installed. The collection and the assessment run from the repo, and that is the whole of it. Read-only by default, and every script header states the permissions it needs and what it touches.
git clone https://github.com/peterwhyte-lgtm/dba-tools
cd dba-tools
.\Initialize-Environment.ps1
🤖 The Health Check, Reviewed by AI
The flagship workflow. A collection runs 45 diagnostic scripts against an instance (backups, waits, blocking, memory, disk, security surface area) and saves every result as a CSV. A rules review turns those into deterministic findings. Then the AI assessment reads the whole collection and does what fixed thresholds can’t: it correlates findings across the outputs into root causes and writes a prioritized report with evidence and a fix for each issue.
Nothing is sent to any AI until you run the assessment step yourself. See a real assessment, end to end →
A 30-second run: terminal command, web UI output, then the same script in SSMS.
Where You Run It
Copy and paste it
Take a script from the post that explains it, or from the repo, and paste it into SSMS. Self-contained and read-only, so it runs as-is.
Needs any query window
Run it from the repo
Clone the toolkit and call scripts by name. Output lands as CSV you can keep and compare, across as many servers as you like.
Needs PowerShell
Start the Web UI
Launch the local dashboard and work from it: health scorecard, drill-downs, AI reports and incident triage. Runs entirely on your machine.
Needs PowerShell, then a browser
Whichever route you pick, most of this ends up in SQL Server Management Studio. If yours is out of date, missing something you expected, or was never set up the way a DBA wants it, the SSMS complete guide covers installing and updating it, the settings worth changing, and the shortcuts that save real time.
Give your AI assistant the same reference, as tools it can call
The assessment above hands an AI one server’s output. The sqldba MCP server hands it the whole library instead: every error write-up, wait type, build and support date, and all 233 scripts with the safety class on each one. Your assistant looks the answer up and cites the page rather than recalling it.
Free, MIT licensed, runs locally, and it has no database connection at all.
Script Articles
Every script on the site, searchable. Type what is actually going wrong, or filter by area.
Showing all 127 scripts
Grab the Toolkit
Free and open source. Every script came from a real situation: an incident, a migration window, or a routine check that needed to be fast and safe.
- Set the Default Database for a SQL Server Login
- SQL Server High CPU: What to Check First, in Order
- Cannot Connect to SQL Server: The Checks in the Order That Finds It
- Cumulative Wait Stats Lie: Measuring Waits Over an Interval
- SQL Server Differential vs Log Backup: Which One Restores What, and How the Chain Breaks
- SQL Server MAXDOP and Cost Threshold: What To Set, and Why 5 Is Not a Recommendation
- Backups & Recovery (17)
- DBA Scripts (150)
- High Availability (HA) (12)
- Installation & Configuration (45)
- Maintenance (24)
- Migration & Upgrades (14)
- Monitoring (9)
- Performance Tuning (37)
- Security (Encryption & Permissions) (19)
- Storage & Capacity (14)
- T-SQL Fundamentals (11)
- Troubleshooting (65)
- Wait Types (235)