Log Backup Sizes

  • Hi Guys, I'm using the following script to list the last 10 log backups and their sizes

    SELECT top 10 BS.database_name as 'Databases', BS.backup_finish_date as 'TransactionLogbackedat',

    BS.backup_size

    FROM msdb..backupmediafamily BMF

    JOIN msdb..backupmediaset BMS ON BMF.media_set_id = BMS.media_set_id

    JOIN msdb.dbo.backupset BS ON BS.media_set_id = BMS.media_set_id

    JOIN master.dbo.sysdatabases SDB ON SDB.name = BS.database_name

    where BS.database_name = 'DB_NAME'

    order by BS.backup_finish_date desc

    How would I get the backup size to display in MB?

    Would the below be accurate?

    BS.backup_size/1024/1024

    Thanks

  • if your log backups are not compressed then it would be ok. but if you are using compressed backups then you should use compressed_backup_size field.

    Regards,
    MShenel

  • Yes, the backup_size field is stored in bytes so your formula is accurate.

    The compressed_backup_size is also stored in bytes so the same formula applies there.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Thanks all

  • You are welcome.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 5 posts - 1 through 4 (of 4 total)

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