Suppose I am going to restore a backup (2 GB) in my sql server, I have sufficient space (20 GB) in my disk, but is there any algorithm that SQL server follows to calculate the minimum disk space required or just randomly checks the disk space and the backup to do a successful restore.

As I want to know the internal working of SQL Server.

Thanks in Advance.

  • You'll need the same amount of space as the source database. Run RESTORE FILELISTONLY FROM DISK=C:\Backups\YourDatabase.bak; to see the file file sizes that will be restored.
    – Dan Guzman
    Feb 21 '20 at 3:55

The backup file maintains metadata about the database and files that SQL Server uses during the restore process. Part of that metadata is a listing of data and log files that are in the database, and their respective sizes (as well as other information).

If you run RESTORE FILELISTONLY you can see the minimum size required for each data and log file in the database that will be restored. When SQL Server performs a normal restore it first checks these values and validates that the disk where each file is to be restore has sufficient space. If not, SQL Server throws an error indicating how much space is required and how much is available on the disk.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.