SQL DBA Blog: Home

  • How to Shrink SQL Server Database Files in Chunks

    Part of the DBA-Tools Project. A data file that’s grown far past what the database actually needs, after a one-off bulk load, an archive cleanup, a migration that left behind a much bigger footprint than the data now occupies, eventually needs to come back down. The problem is that a single DBCC SHRINKFILE targeting the…

    read more

  • DBA Scripts: Get Lock Escalation, Contention Analysis, and Blocking Chains with Plan

    Part of the DBA-Tools Project. Three Different Views of the Same Underlying Problem Blocking Chains shows what’s blocked right now. These three scripts go wider and deeper: Get-LockEscalationStats finds which tables have converted row/page locks into full table locks (a common, self-inflicted cause of blocking), Get-ContentionAnalysis rolls up lock waits, latch waits, TempDB allocation contention,…

    read more

  • DBA Scripts: Get Trace Flags and Resource Governor Configuration

    Part of the DBA-Tools Project. Two Things a Previous DBA Might Have Set and Never Told You Trace flags and Resource Governor are both instance-wide behavior changes that don’t show up in sp_configure at a glance, don’t appear in the database, and can sit silently in place for years, inherited from whoever configured the server…

    read more

  • DBA Scripts: Get CPU Topology and OS Configuration Checks

    Part of the DBA-Tools Project. What CPU and OS Settings Are Actually Doing to SQL Server OS and Hardware Info tells you what hardware exists. These two scripts go one level deeper: how SQL Server is actually scheduling work across that hardware, and whether a handful of OS-level settings invisible from Task Manager, Lock Pages…

    read more

  • DBA Scripts: Get Backup Size Trend

    Part of the DBA-Tools Project. What Your Backup Sizes Are Quietly Telling You Nobody watches backup file sizes month to month, they just watch that the backup succeeded. But backup size is a free, already-collected proxy for data growth rate, and it catches two things a success/failure check never will: a database whose backups are…

    read more

  • DBA Scripts: Get Last DBCC CHECKDB

    Part of the DBA-Tools Project. DBCC CHECKDB is the only thing that actually confirms a database’s data is structurally sound; backups only prove a database can be restored, not that what gets restored is undamaged. Skipping it, or letting it silently stop running, means corruption can sit undetected for weeks or months before anyone notices, often only when…

    read more

  • DBA Scripts: Get Index Fragmentation

    Part of the DBA-Tools Project. Index fragmentation is one of those topics where the received wisdom, “rebuild your indexes every weekend”, causes almost as many problems as it solves. Rebuilding an index that doesn’t need it wastes a maintenance window, takes a schema lock on Standard Edition, and generates unnecessary transaction log. Not rebuilding an…

    read more

  • DBA Scripts: Get Autogrowth History

    Part of the DBA-Tools Project. SQL Server autogrowth is one of those settings that is often ignored until it becomes a production problem. A database file growing during normal business hours is usually a sign that SQL Server is reacting to a capacity issue. The engine pauses normal operations, extends the data or log file, then continues…

    read more

  • How to Delete Duplicate Rows in SQL Server

    Every DBA hits this one eventually. A table has two or more rows that are identical in every column that matters, and you need to remove all but one of them. An ETL job re-ran without a dedupe check. An import script fired twice. A missing unique constraint let bad data in through the front…

    read more

  • DBA Scripts: Server Inventory

    Part of the DBA-Tools Project, in the Server and Configuration area. Everything You’d Need Before Touching an Unfamiliar Server Hand a DBA a server they’ve never seen before, and there’s a fixed set of questions that come first, before performance tuning, before security review, before anything: what version and edition is this, what’s the OS…

    read more