DBA Fundamentals: Maintenance: Shrinking Files

Sdílet
Vložit
  • čas přidán 25. 07. 2024
  • When you've got a lot of empty space inside a database, you can use DBCC SHRINKDB or SHRINKFILE in order to downsize the file and free up space on your drives. But should you? I'll explain how those commands work, why they make performance worse, and give you alternatives.
  • Věda a technologie

Komentáře • 13

  • @user-xp5sk8ts3q
    @user-xp5sk8ts3q Před 2 lety +1

    Thanks for the interesting story about the architecture of hard drives.

  • @kennethgardzinski
    @kennethgardzinski Před 2 lety +1

    Good information as usual. Thank you 😊.

  • @kelleyprebil8571
    @kelleyprebil8571 Před 2 lety +3

    Great explanation! I accidentally shrunk the log file on one of my Production servers as I was trying to shrink it on my sandbox server actually and didn't realize I was connected to the wrong server. Oops. I've only had to shrink that Production server's log file once when someone decided to do a massive delete + insert instead of just updating the data which blew up the log file size to WAY bigger than normal and WAY bigger than the data file. Tripled the size of the backups too.

    • @totanlj18
      @totanlj18 Před rokem

      Thanks God you do only a Shrink on that server!

  • @clasmir5281
    @clasmir5281 Před 3 lety +1

    Great content! Almost done with this bag of popcorn!

  • @samdani870
    @samdani870 Před 3 lety +4

    Much clear on shrink. Can you make a video of lock, block, and deadlock with a bunch of real examples please.

    • @BrentOzarUnlimited
      @BrentOzarUnlimited  Před 3 lety

      Sure, I have - check out my Mastering Index Tuning and Mastering Query Tuning classes where we spend about 3 hours in total on blocking and deadlocking. To learn more, go to BrentOzar.com and click Training at the top.

  • @avanthasiriwardana
    @avanthasiriwardana Před 2 lety

    perfecto :)

  • @Vibestr
    @Vibestr Před 6 měsíci

    Hello Brent
    Thank you for the explanation. It helped me understand why shrinking paired w/ rebuilding indexes is a fruitless cause. Is the shrinking that you describe an example of notruncate because i was reading a truncate shrink doesn't move any files over but simply drops ("deallocates") the space at the end (and henceforth it is much more faster process)? Would using a truncate shrink be good since it doesn't reshuffle the database and perhaps there would be no need to perform a defrag? Or is having that extra unused allocated space not such a bad thing since it can make future inserts easier?

  • @paulntumbong9568
    @paulntumbong9568 Před rokem

    Good analysis sir, what script can you use to know what exactly is causing the log file growing big

    • @TheBrentOzar
      @TheBrentOzar Před rokem

      Thanks! I cover that in my How I Use the First Responder Kit class.

  • @lirusme2461
    @lirusme2461 Před 4 měsíci

    How about tempdb datafile that continue growth because of verrion store? how to identification what transaction process and query that running?