Thursday, August 28, 2014

DATABASE Backup Recovery Model and Last Completion Date


select @@servername, * from

(

-- Query last backup

SELECT  

              d.name,

              d.recovery_model_desc,

              b.type,

        MAX(b.backup_finish_date) AS backup_finish_date

FROM     master.sys.databases d

         LEFT OUTER JOIN msdb..backupset b

         ON       b.database_name = d.name

         --AND      b.type          = 'L'

GROUP BY d.name, b.type, d.recovery_model_desc

--ORDER BY backup_finish_date DESC

) a

 

No comments:

Post a Comment