I've got the below and have several variation and still cant seem to find a perfect way to query the server to bring back that last full backup per db. I'm shopwing mutilple records in the backup set db w/ type = 'D'. I look online and type D = Database. Which i assumed it meant full database backup. Apparently not. Try running the below on one of your full databases. Then check to see if the date is actually the last backup date. DECLARE @db_name VARCHAR(100)SELECT @db_name = DB_NAME()-- Get Backup History for required databaseSELECT TOP ( 30 ) s.database_name, m.physical_device_name, Cast(Cast(s.backup_size / 1000000 AS INT) AS VARCHAR(14)) + ' ' + 'MB' AS bksize, Cast(Datediff(second, s.backup_start_date, s.backup_finish_date) AS VARCHAR(4)) + ' ' + 'Seconds' timetaken, s.backup_start_date, Cast(s.first_lsn AS VARCHAR(50)) AS first_lsn, Cast(s.last_lsn AS VARCHAR(50)) AS last_lsn, CASE s.[type] WHEN 'D' THEN 'Full' WHEN 'I' THEN 'Differential' WHEN 'L' THEN 'Transaction Log' END AS backuptype, s.server_name, s.recovery_modelFROM msdb.dbo.backupset s INNER JOIN msdb.dbo.backupmediafamily m ON s.media_set_id = m.media_set_idWHERE s.database_name = @db_nameand s.[type]='d'ORDER BY backup_start_date DESC, backup_finish_date
↧