getting size of backup from within msdb

  • Hi,

    I would like to write a script (with T-sql) to be used in a alert/job setup, to check the size of my backup.

    At a certain size an alert should be given and action undertaken.

    But I can't find the size of the file(s) in the tables: backupfile and backupset. The (file_ or backup)size given, does not correspond with the OS file(size.

    Should I forget about doing this via T-sql and simple use NT Scripting?

    I prefer T-sql.

    Thanks in avance,

    Marcel


    With Kind Regards/Met vriendelijke groet
    Schil
    'It's never ending and never surrendering' Unida 1999

  • If you look at the backupset table the field backup_size is the number of bytes of the backup, but for the size of the backup file add 1536 which is apparently for the header/footer information of the file. These sizes with the header/footer may be correct even for Tape but not 100% sure. Here is an example

    SELECT

    database_name,

    backup_set_id,

    (backup_size + 1536) As SizeInBytes,

    Backup_Start_date

    FROM

    backupset

    WHERE

    database_name = 'DBx'

    ORDER BY

    Backup_Start_Date

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

    Edited by - antares686 on 05/14/2002 06:04:42 AM

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply