Friday 19 April 2013

Find the date and time of the last backup for all databases

To find the date and time of the last backup for all the databases in the SQL Server instance run this simple query:
SELECT s.Name AS Database_Name,
MAX(b.backup_finish_date) AS BackUpTime
FROM sys.sysdatabases s
LEFT OUTER JOIN msdb.dbo.backupset b ON b.database_name = s.name
GROUP BY s.Name

No comments:

Post a Comment