Category: Maintenance

  • How to Shrink SQL Server Database Files in Chunks

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks. 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…

  • When Shrinking Temp DB Just Won’t Shrink

    This is broken. You run DBCC SHRINKFILE on the Temp DB data files, maybe throw in a CHECKPOINT for good measure, and nothing moves. The files sit there stubbornly taking up space you need back. I am not in the habit of shrinking databases. It fragments files and usually just creates more work later. But…

  • How to Right-Size SQL Server Database Files

    Auto-growth is not the problem. Unplanned, reactive growth is. When database files are undersized, SQL Server is forced to extend them repeatedly under load. Each growth event introduces a pause. If those pauses occur during peak workload, they can cause noticeable latency, increased I/O pressure, and in some cases application timeouts. Right-sizing database files is…

  • Applying Data Retention Safely in SQL Server

    Data retention in SQL Server usually means deleting old data in a controlled and repeatable way. That might be driven by compliance requirements, table growth that’s starting to hurt performance, SQL Server Express size limits, or simply keeping log and audit tables under control. Whether this is a one-off cleanup or a permanent maintenance task,…