2

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.

asked Feb 21, 2020 at 2:09
1
  • 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. Commented Feb 21, 2020 at 3:55

1 Answer 1

5

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.

answered Feb 21, 2020 at 4:31

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.