SQL Server Performance

Script for checking databases backups

Discussion in 'Performance Tuning for DBAs' started by vaddi, Aug 7, 2006.

  1. vaddi New Member

    I would like to get a script , which can give me back...whether the last night database backup has succeeded or failed.

  2. Luis Martin Moderator


    select database_name,
    convert(smalldatetime,max(backup_finish_date)) as last_backup,
    datediff(d, max(backup_finish_date), getdate()) as days_since_last
    from msdb.dbo.backupset
    where type = 'd' --Database backup, use 'L' if you want to see the Log backups
    group by database_name

    Luis Martin

    All in Love is Fair
    Stevie Wonder

    All postings are provided “AS IS” with no warranties for accuracy.

Share This Page