Get restore dates for all databases

Get restore dates for all databases

SELECT
    SERVER_NAME [SOURCE SERVER]
    ,RECOVERY_MODEL
    ,DESTINATION_DATABASE_NAME
    ,RESTOREHISTORY.[USER_NAME]
    ,MAX(RESTORE_DATE)
FROM
MSDB.DBO.BACKUPSET
INNER JOIN MSDB.DBO.RESTOREHISTORY
    ON BACKUPSET.BACKUP_SET_ID = RESTOREHISTORY.BACKUP_SET_ID
GROUP BY
    SERVER_NAME
    ,RECOVERY_MODEL
    ,DESTINATION_DATABASE_NAME
    ,RESTOREHISTORY.[USER_NAME]

No comments:

Post a Comment