Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favourite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved in your SSC briefcase from the favorites tab.
Download now (direct download link)

Get total file size of backup for last full backup

By James Travis,

The information for backup size is stored in the backup_size column of the backupset table in the msdb database as the total bytes for that backup.
This script allow you to look at the total back to tape or file so you can plan space needs for those devices.
This is a simple piece of code so you may need to adjust for your specific needs, but the basic outline of it should help you in looking at your backups in whatever situation you need.
Also files have a header and maybe footer so there are some extra bytes added beyond what is stored in the database for this information which is 1536 and has been calculated in.

Some Options you should be aware of when using this code.

backupmediafamily device_type
2 = File
5 = Tape

backupset type
L = Log
I = Differential
D = Full

(Note: May be other options but these are the ones I find on my system and can identify.)

Total article views: 2011 | Views in the last 30 days: 28
 
Related Articles
FORUM

backup

backup

FORUM

backup

backup

FORUM

backup

backup

FORUM

Backup

Backup

FORUM

backup

backup

 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones