문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top