SQL Server: how to query when the last transaction log backup has been taken?

前端 未结 2 770
隐瞒了意图╮
隐瞒了意图╮ 2021-02-07 09:36

I would like to query for all databases (in SQL Server 2008 instance) date when the last transaction log backup has been taken. How to do that? I know that this information is s

相关标签:
2条回答
  • 2021-02-07 10:11
    SELECT   d.name,
             MAX(b.backup_finish_date) AS backup_finish_date
    FROM     master.sys.sysdatabases d
             LEFT OUTER JOIN msdb..backupset b
             ON       b.database_name = d.name
             AND      b.type          = 'L'
    GROUP BY d.name
    ORDER BY backup_finish_date DESC
    
    0 讨论(0)
  • 2021-02-07 10:13

    I recommend using this modified script so you can see which database is in FULL or BULK_LOGGED recovery model and not having any LOG BACKUP.

    SELECT   d.name,
             d.recovery_model_desc,
             MAX(b.backup_finish_date) AS backup_finish_date
    FROM     master.sys.databases d
             LEFT OUTER JOIN msdb..backupset b
             ON       b.database_name = d.name
             AND      b.type          = 'L'
    GROUP BY d.name, d.recovery_model_desc
    ORDER BY backup_finish_date DESC
    
    0 讨论(0)
提交回复
热议问题