Search code examples
sql-serverssmsshrinktransaction-log

Restored database taking massive amount of space


I restored a database with a 1.5gb .bak file. Everything works fine except the restored database now takes 64gb of space.

I've heard about shrinking databases and log files but how should I find out what is it that takes so much space and what I can "shrink" so that the data itself won't change. I need this production backup data in my development environment as it is.

I don't need full logs in the development environment where I'm doing the restoring. How to find out is it the data or the logs that take more space?

I'm using SQL Server Management Studio 2017


Solution

  • Maybe logs?

    I suggest you to analyze if that fits you. Make the backups much shorter: See More

    BACKUP DATABASE XXXXX TO DISK 'C:\XXX.bak' WITH COPY_ONLY
    

    You can also change the Recovery Model from Full (Default) to Simple, after the restore.

    That shows where you can change it


    Then SHRINK it


    I'm honestly not sure if all of those are necessary, but that works for me to reduce space. Maybe shrinking before changing recovery model is better, or maybe one of those are not the best pratices.