Category: Performance Tuning
-
DBA Scripts: Get XE Session Activity
Standing up a trace session is the easy part. The actual decision, is this database safe to decommission, is that service account still connecting from the right host, comes from reading the results back and turning raw events into an answer. Extended Events writes to rolling .xel files, and reading those directly means shredding XML…
Written by
-
DBA Scripts: Get Active XE Sessions
Extended Events sessions have a way of quietly accumulating on a busy instance. Someone stood up a trace for a specific investigation six months ago, and it’s still running, still writing files, and nobody remembers why. Before you start a new session, or clean up an old one, you need one honest answer to “what’s…
Written by
-
DBA Scripts: Create SP Execution Session
Query Store and the plan cache tell you what’s expensive. Neither tells you what’s actually called, by what, how often. Before a migration, you need to know which stored procedures matter in practice, not which ones look interesting in a cached plan that might not even be current anymore. Before a decommission, you need the…
Written by
-
DBA Scripts: Create Decommission Audit Session
“I think nothing uses this database anymore” is not evidence. It is a guess, and it is the kind of guess that turns into an incident report when the thing you dropped turns out to be feeding a monthly finance job nobody remembered. Proving a database is genuinely unused takes more than checking recent connections…
Written by
-
DBA Scripts: Create Login Activity Session
“Who actually connects to this server?” is a question you can’t answer from documentation. Not who’s supposed to connect, who is. Ownership changes, connection strings get copied into three other applications nobody told you about, and a service account keeps authenticating from a box that was decommissioned eighteen months ago. None of that shows up…
Written by
-
DBA Scripts: Get Schema Change History
“What Changed on This Server Recently?” A query that worked yesterday now errors, a report comes back empty, a job that always succeeded fails, and everyone says nothing changed. Before chasing the symptom, answer the basic question directly: did anything change here? This script reads the SQL Server default trace, on by default, and returns…
Written by
-
DBA Scripts: Get Active Connections by Database
The Check Before You Take Anything Offline Taking a database offline, whether for a decommission, a restore, or a maintenance operation that needs exclusive access, starts with the same question: is anyone actually using it right now? Guessing wrong means an unexpected outage for whoever was still connected. This script answers that in one pass…
Written by
-
DBA Scripts: Get Query Store Regressions and Forced Plans
“What Changed Today” and “Is the Plan I Forced Still Any Good” A query that was fine yesterday is slow today, or a plan you forced has stopped protecting it. The first script compares each query’s last 24 hours in Query Store with its own previous 6 days; the second lists every forced plan with…
Written by
-
DBA Scripts: Get Index Usage Stats
The Raw Usage Data Behind Every Index Decision Unused Indexes already filters straight to drop candidates in one database. This script is the raw data underneath that filter, and more: every index across every user database, its seeks, scans, lookups, and updates, classified into a usage pattern, with no filtering applied. It’s the source data…
Written by
-
DBA Scripts: Get Query Performance Deep-Dive
When Top CPU Doesn’t Explain “Why Is This Slow” The query usually runs fine and sometimes takes forever, or the server is slow and Top CPU Queries names nothing that explains it. A CPU ranking tells you what was busy, not why something was slow. These four scripts go after the usual reasons it misses:…
Written by
- Tune a Slow Query With Copilot in SSMS
- xp_readerrorlog: Read the SQL Server Error Log with T-SQL
- Cannot Drop Database Because It Is Currently in Use (Error 3702)
- Could Not Drop Login Because the User Is Currently Logged In (Error 15434)
- Set a Maximum Database File Size in SQL Server (MAXSIZE)
- SQL Server Activity Monitor in SSMS (and the Performance Dashboard)
- Backups & Recovery (18)
- DBA Scripts (154)
- High Availability (HA) (13)
- Installation & Configuration (60)
- Maintenance (25)
- Migration & Upgrades (14)
- Monitoring (10)
- Performance Tuning (38)
- Security (Encryption & Permissions) (25)
- Storage & Capacity (18)
- T-SQL Fundamentals (17)
- Troubleshooting (108)
- Wait Types (236)