Thursday, November 4, 2010

Find out last backup time for all databases

This is merely a re-post of a script done on SQL Authority that I placed on my site so I can easily find it in the future.

If you have not read any of Pinal Dave's blogs (SQL Authority), you should - he posts some very good information and knows a vast amount about SQL and it's inner workings.

 This script will display by database the last time it was backed up.

SELECT sdb.Name AS DatabaseName,
COALESCE(CONVERT(VARCHAR(12), MAX(bus.backup_finish_date), 101),'-') AS LastBackUpTime
FROM sys.sysdatabases sdb
LEFT OUTER JOIN msdb.dbo.backupset bus ON bus.database_name =
GROUP BY sdb.Name
Order by 2

No comments:

Post a Comment