Script to find Backup History- SQL Server

This Script gives the backup history of all databases with in a instance. Also gives you when is the database last backed up ?

SERVERPROPERTY('Servername')) AS Server,
MAX(msdb.dbo.backupset.backup_finish_date) AS last_db_backup_date
msdb.dbo.backupmediafamily  INNER JOIN msdb.dbo.backupset
ON msdb.dbo.backupmediafamily.media_set_id = msdb.dbo.backupset.media_set_id 
WHERE  msdb..backupset.type = 'D'
GROUP BY msdb.dbo.backupset.database_name 
ORDER BY msdb.dbo.backupset.database_name

If this script is useful to you leave a comment saying what type of query else you would like to see in here.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s