SQL DBA Blog: Home

  • DBA Scripts: Get Disk Space on SQL Server

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Storage & Capacity A SQL Server that runs out of disk stops taking writes, and depending on which volume filled up, that can mean suspended databases, a frozen transaction log, or failed backups at exactly the wrong moment. Disk space is the least…

    Read More


  • Testing Remote Server Port Connectivity with PowerShell

    Testing connectivity to remote server ports is a basic skill every DBA should have. Not just DBAs either, anyone running production systems needs to be able to answer one simple question quickly: Can this server actually reach that server on this port? This post shows two reliable ways to test whether a remote port is…

    Read More


  • DBA Scripts: Get Long-Running Queries

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Performance & Troubleshooting › Query & Performance Tuning When users report the application is slow, the first question is always the same: what is actually running right now? Not what ran an hour ago, not what the plan cache thinks is expensive on…

    Read More


  • How to Check Listening Ports on Windows

    When troubleshooting connectivity issues, it’s often not enough to test whether a remote port is reachable. You also need to know what is actually listening on a port locally, or whether anything is listening at all. This post focuses on the local side of the equation, what is listening on the machine itself and which…

    Read More


  • DBA Scripts: Get Missing Indexes

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Maintenance & Automation › Index Maintenance Every time SQL Server builds an execution plan that could have been improved with a better index, it makes a note of it. Those notes accumulate in memory and are queryable through the sys.dm_db_missing_index_* DMVs, and combined…

    Read More


  • Get Last Database Restore Date and Time in SQL Server

    Knowing when a database was last restored is useful during incident response, audits, and general environment validation. This is not about backup schedules or restore progress.It is a simple historical check that answers one question: When was this database last restored? This post shows a reliable way to retrieve the most recent restore date and…

    Read More


  • DBA Scripts: Get Index Fragmentation Across Databases

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Maintenance & Automation › Index Maintenance Index fragmentation checks are usually written for one database at a time, which is fine until you inherit an instance with forty databases and no idea which of them has been skipping maintenance. Running a per-database script…

    Read More


  • DBA Scripts: Get User Permissions Audit

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Security The One Login You Actually Care About Right Now Most permissions checks answer a broad question: who has sysadmin, what roles exist, what’s granted where. Useful for a periodic audit, but not what you reach for when someone asks “why does Sarah…

    Read More


  • Deleting Rows in Batches in SQL Server

    Deleting large volumes of data from a SQL Server table looks simple, but it can cause real problems if done carelessly. A single large DELETE can: When you’re cleaning up historical data or running routine maintenance, deleting rows in batches is usually the safest and most predictable approach. This post shows a simple, production-safe pattern…

    Read More


  • DBA Scripts: Get Database IO Usage

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Performance & Troubleshooting › Query & Performance Tuning When a SQL Server is struggling and the usual suspects (CPU, memory, blocking) come back clean, the next question is always the same: which database is hammering the disks? On a busy instance hosting ten…

    Read More