Technical Article

Display the number of days since last Database backup.

,

Execute the above SQL script in SSMS. Tested the above script on SQL Server 2008 R2.

More information about Backupsets can be found on the following website

http://technet.microsoft.com/en-us/library/ms186299(v=sql.105).aspx

---------------------------------
--Days Since Last Backup of data.
---------------------------------
SELECTDATABASE_NAME, CONVERT( VARCHAR(20) , 
MAX(BACKUP_FINISH_DATE)) AS LAST_BACKUP, 
DATEDIFF(D, MAX(BACKUP_FINISH_DATE), GETDATE()) AS DAYS_SINCE_LAST_BACKUP
FROMMSDB.DBO.BACKUPSET
WHERETYPE = 'D' 
GROUP BYDATABASE_NAME 
ORDER BYDAYS_SINCE_LAST_BACKUP DESC

Rate

4 (4)

You rated this post out of 5. Change rating

Share

Share

Rate

4 (4)

You rated this post out of 5. Change rating