TL;DR summary:  Don’t do it.  Stop reading here if you want, but just don’t do it. This post refers to shrinking your database files (mdf, or ndf files), not shrinking the log file. The log file is a completely different conversation, however, shrink database does shrink the log file. Not shrinking your database is one of the more counter intuitive …

DBCC ShrinkDatabase – I want to shrink my database. Read more »

Recently when shrinking a SQL Server data file, I ran into the following error: Before I get any grief about how bad shrinking databases is, and a puppy being sacrificed every time shrink database is run, yes there was a legitimate reason to shrink the data file. The client was low on disk space, and a huge amount of data …

DBCC Shrink Fails with Error Read more »

Now is your chance to ask a question about corruption in SQL Server databases. We will do our best job of answering those questions on our February webcast on database corruption. Do you have a question about the output from DBCC CheckDB? Seeing a strange error in your SQL Server logs? Is your SQL Server sending alerts related to corruption? …

Ask a question about Database Corruption Read more »

TL;DR summary: Don’t do it. Stop reading here if you want, but just don’t do it. This post refers to shrinking your database files (mdf, or ndf files), not shrinking the log file. The log file is a completely different conversation, however shrink database does shrink the log file. Not shrinking your database is one of the more counter intuitive …

DBCC ShrinkDatabase – I want to shrink my database. Read more »

If you use the SQL Server maintenance plans to run DBCC Check DB, you are not allowed to include TempDB in your DBCC CheckDB sequence. For a while I was using maintenance plans, and ending up adding a separate job step to run TSQL to just check TempDB. Rather than using two different steps, the regular maintenance plan, and a …

DBCC CheckDB All Databases Read more »

The following DBCC commands are all hidden in the word search.  Be aware, some of the DBCC commands are undocumented. CACHESTATS CHECKCATALOG CHECKCONSTRAINTS CHECKDB CHECKFILEGROUP CHECKIDENT CLEANTABLE DROPCLEANBUFFERS FLUSHPROCINDB FREE FREEPROCCACHE FREESESSIONCACHE FREESYSTEMCACHE INDEXDEFRAG OPENTRAN OUTPUTBUFFER PAGE PROCCACHE SHOWCONTIG SHRINKDATABASE TRACEON TRACESTATUS UNPINTABLE UPDATEUSAGE USEROPTIONS END OF PUZZLE ————————- See also: For more information on DBCC Commands: DBCC CheckAlloc DBCC …

SQL Sunday Fun – Word Search with SQL Server DBCC Commands Read more »

This is my 250th blog post at Steve Stedman.com.  Many of the post over the last year have been focused on Common Table Expression topics as I finished my CTE Book, however with last month being DBCC Command Month here there were many posts completely unrelated to CTEs. Another category that accounts for many of the posts is the Database …

250th Blog Post at SteveStedman.com Read more »

As the month of May comes to an end so does DBCC command month at SteveStedman.com. I didn’t cover all the DBCC Commands this month, but here is what I did have time to cover: May 1st – DBCC CheckAlloc May 2nd – DBCC CheckCatalog May 3rd – DBCC CheckConstraints May 4th – DBCC CheckDB May 5th – DBCC CheckFilegroup May 6th – DBCC CheckIdent May …

End of DBCC Command Month Read more »

Being day 27 of the DBCC Command month at SteveStedman.com, today’s featured DBCC Command is DBCC SQLPERF. Description: DBCC SQLPERF is used to do a couple different things. Show a list of all the wait stats on your SQL Server. Show a list of the transaction log and the space used in the transaction log. Clear the wait stats. Clear …

DBCC SqlPerf Read more »

Being day 25 of the DBCC Command month at SteveStedman.com, today’s featured DBCC Command is DBCC SHRINKFILE. Description: DBCC SHRINKFILE is used to shrink an individual log in SQL Server. DBCC SHRINKFILE Syntax: Example: The following example DBCC ShrinkFile is used to shrink a log file that grew too large. Related Posts: Blog Post Shrinking a Log File. Notes: For …

DBCC ShrinkFile Read more »