简体   繁体   中英

Space utilization is huge when database backup file is restored in another PC

I'm trying to restore backup file(.bak) to my Sql Server, .bak file size is 40 MB. But after restoration to Sql Server 2012, it occupies 100 to 120 GB space in C drive. How to fix this?

(OS and SQL installed in C: drive)

The restored database is as big as the database the backup was taken on. Reduce the size before taking the backup or reduce the size after restoring.

SQL Server won't backup empty space in your database files. If you have a log file that is 100GB large but it's empty then if won't take any space in your backup file.

If you restore the backup the files will be restored to there original size. The log file will be 100 GB again.

The same thing goes for the data files.

EDIT:

If you have a log file of 100 GB while your data is only 40 MB then something might be configured wrong. Is the database is full recovery without making any transaction log backups?

This might not be the perfect answer, but is one of the best solutions for my problem.

after taking .bak file, restore it with "restore with non-recovery mode", stop the SQL service, delete the .ldf file, re-start service, re-boot system.

This helped me empty the disk space of 100 GB(.ldf = 100 GB)

The answers which helped me resolve this are ...

Why do we need the LDF files along with MDF files? on stackoverflow

and my seniors suggestion.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM