SQL Server DBCC Commands Guide
Jun 8, 2026 / · 10 min read · sql server dbcc commands database maintenance database administration maintenance scripts sql scripts consistency checks dbcc checkdb dbcc shrinkfile plan cache sys.dm_exec_requests sys.dm_db_log_space_usage sys.dm_exec_cached_plans sys.dm_exec_input_buffer sys.dm_exec_sql_text ·An incident rarely announces which DBCC statement it needs. A log file stops truncating, a query slows after a plan changes, an identity column runs ahead of its table, and each one has a Database Console Command that answers it, sitting next to a few that can make the same situation worse. The DBCC statements are …
Read MoreSQL Server DBCC CHECKDB Guide and Repair Options
Jun 7, 2026 / · 10 min read · sql server database corruption consistency checks database maintenance dbcc commands database administration maintenance scripts sql scripts dbcc checkdb sys.databases ·Running DBCC CHECKDB on a schedule is only the start, because its options change what it checks, how long it takes and what it can do to your data. This post covers the check options, a script that runs the command against every online user database, and the three repair levels, including why REPAIR_ALLOW_DATA_LOSS is …
Read MoreA stored procedure that returned in 20 milliseconds yesterday is timing out today, and nothing in the code changed. Indexes are intact and statistics look current, yet the query now takes a different, slower path. One cause worth checking is a cached plan that was compiled for an unrepresentative set of parameter …
Read MoreSQL Server DBCC SHRINKDATABASE: When and When Not to Shrink
A one-time data load doubled a data file overnight, the load is done, the rows are deleted, and the file is now mostly empty space. The reflex — reach for DBCC SHRINKDATABASE and give the disk back — is a common way to hurt performance without meaning to. This post explains what shrinking does to your indexes, when it …
Read MoreSQL Server DBCC CHECKIDENT: Check and Reseed Identity
A logging table grew to forty million rows, the bulk of it was archived out, and now only the last week's data remains — but the next insert still gets identity value 40,000,001, leaving a vast gap below it. Or a botched data load left the seed sitting far above the real maximum, and future inserts skip millions of …
Read MoreDBCC DBREINDEX vs ALTER INDEX REBUILD in SQL Server
Open the SQL Agent job history on an instance that has been running for a decade and you will still find DBCC DBREINDEX in a nightly maintenance step, quietly doing its job. It works — which is exactly why nobody has touched it. But it has been deprecated for the better part of twenty years, it locks tables it does not …
Read MoreSQL Server DBCC CHECKDB Last Run Date Report
Apr 17, 2026 / · 8 min read · sql server dbcc commands database maintenance database integrity DBCC CHECKDB DBCC DBINFO dba scripts database administration sql server monitoring integrity check sys.databases ·In busy SQL Server environments it is easy to lose track of which databases have had a recent DBCC CHECKDB and which have not. This script loops through all user databases, reads the last known good DBCC CHECKDB date from each one, and presents the results sorted from oldest to newest so you can spot gaps fast. Purpose …
Read MoreSQL Server DBCC DBREINDEX with Timing: Index Maintenance
Aug 5, 2025 / · 4 min read · sql server database maintenance performance tuning dbcc commands index optimization dba scripts database administration sql scripts DBCC DBREINDEX sysobjects ·SQL Server DBCC DBREINDEX Script with Timing - Database Maintenance Guide Database maintenance is a critical aspect of SQL Server administration, and index rebuilding plays a vital role in maintaining optimal database performance. This comprehensive guide explores powerful DBCC DBREINDEX scripts that include timing …
Read MoreDBCC DBREINDEX: SQL Server Index Rebuild Script
Aug 4, 2025 / · 5 min read · sql server database maintenance indexing performance tuning automation dbcc commands database administration optimization DBCC DBREINDEX sysobjects ·SQL Server DBCC DBREINDEX Script Generator for Database Maintenance Database maintenance is crucial for optimal SQL Server performance, and one of the most important tasks is maintaining database indexes. The DBCC DBREINDEX command is a powerful tool for rebuilding indexes, but manually running it on every table can be …
Read MoreSQL Server DBCC CHECKIDENT: Bulk Identity Column Analysis
Aug 3, 2025 / · 8 min read · sql server database administration identity columns maintenance scripts dbcc commands sql scripts dbcc checkident sysobjects sys.tables sys.schemas sys.identity_columns ·DBCC CHECKIDENT with NORESEED reports the current identity value of a table next to the largest value actually stored in the identity column, without changing either. It works on one table per call, so checking a whole database means writing one command per table. The script below generates those commands from the …
Read More