Technical Article

Recent Restore History

,

Simply execute on your instance to receive the most recent info about any database restores that have taken place on the server.

SET NOCOUNT ON
SELECT
 destination_database_name
,bmf.physical_device_name
,restore_date
FROMmsdb.dbo.restorehistory
INNER JOINmsdb.dbo.backupsetas bsON bs.backup_set_id= msdb.dbo.restorehistory.backup_set_id
INNER JOINmsdb.dbo.backupmediafamilyas bmfON bs.media_set_id= bmf.media_set_id 
WHERE restore_history_id IN 
(
SELECT MAX(restore_history_id)
FROM msdb.dbo.restorehistory
WHERE restore_type = 'D' 
AND destination_database_name IN 
(
SELECT DISTINCT destination_database_name 
FROM msdb.dbo.restorehistory
)
GROUP BY destination_database_name 
)
ORDER BY restore_date DESC
SET NOCOUNT OFF

Rate

4.67 (6)

You rated this post out of 5. Change rating

Share

Share

Rate

4.67 (6)

You rated this post out of 5. Change rating