Retrieve the Last Backup Dates for All Databases in an MS SQL Instance

30 Mar, 2021·
AlexIn Tech
AlexIn Tech
· 1 min read

Retrieve the Last Backup Dates for All Databases in an MS SQL Instance

Here’s a handy SQL script to check when your databases were last backed up on an MS SQL instance.

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 = sdb.name
GROUP BY sdb.Name

Enjoy! ;-)

AlexIn Tech
Authors
SysOps Engineer | IT Teacher
Versatile IT Engineer with a dual specialization in System Engineering and Management, AlexIn Tech teaches IT to CFC apprentice IT specialists at ETML, the Technical School of Lausanne 🇨🇭. Passionate about IT, innovation, and knowledge sharing, he shares his discoveries and learnings here to inspire new generations.