Monday, 6 May 2013

Checking up on Backup history?

Ever needed to show the history of your backups? Here is the SQL script to do it


SELECT top 10
    database_name,
    recovery_model,
    CASE bs.type
        WHEN 'D' THEN 'FULL'
        WHEN 'I' THEN 'DIFFERENTIAL'
        WHEN 'L' THEN 'TRANSACTION LOG'
        ELSE 'UNKNOWN'
    END AS backup_type,
    backup_start_date,
    backup_finish_date,
    backup_size,
    compressed_backup_size
FROM msdb.dbo.backupset bs
where database_name = 'AX2012'
order by backup_finish_date desc