Question

The amount of free space on my machine is limited, and I'd like to know how many dbs I can fit on it before restoring them.

So given a .bak file, how can I estimate how big its restored database on SQL server will be?

Was it helpful?

Solution

This output:

RESTORE FILELISTONLY FROM DISK = 'c:\path\file.bak';

Has a Size column (in bytes). You can perform math to extrapolate from there, for example let's say the results in that column are:

3211264
 802816

These are in bytes, and expressed in KB (at least how Windows Explorer exposes it) would be:

3211264 + 802816) / 1024 = 3,136 KB

And in MB would be:

3211264 + 802816) / 1024 / 1024.0 = 3.0625 MB

You may want the SUM of the whole column, or you may want to RESTORE ... WITH MOVE and place different files on different drives if you have the ability to do so, in which case you'll want to consider different files separately.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top