View Last 20 Database Backups


DECLARE @DBName VarChar(128)
SELECT @DBName = 'YourDB'
SELECT
TOP 20
bs.machine_name
,bs.database_name
,bs.backup_start_date
,bf.physical_device_name
FROM
msdb.dbo.backupset bs (NOLOCK)
JOIN msdb.dbo.backupmediaset bms (NOLOCK) ON bms.media_set_id = bs.media_set_id
JOIN msdb.dbo.backupmediafamily bf (NOLOCK) ON bf.media_set_id = bms.media_set_id
WHERE
bs.database_name = @DBName
ORDER BY
bs.backup_set_id desc

Comments :

0 comments to “View Last 20 Database Backups”