web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

Useful SQL Query (Part 1) – History of Database Restore

Amir Nazim Profile Picture Amir Nazim 5,994

History of Database Restore

Sometime in administration work you would like to see history of database restore, like when we have restored this version of data. Usually helps in development and test system.

SELECT [rs].[destination_database_name],
[rs].[restore_date],
[bs].[backup_start_date],
[bs].[backup_finish_date],
[bs].[database_name] as [source_database_name],
[bmf].[physical_device_name] as [backup_file_used_for_restore]
FROM msdb..restorehistory rs
INNER JOIN msdb..backupset bs
ON [rs].[backup_set_id] = [bs].[backup_set_id]
INNER JOIN msdb..backupmediafamily bmf
ON [bs].[media_set_id] = [bmf].[media_set_id]
ORDER BY [rs].[restore_date] DESC

Screen-Shot-2015-01-20-at-12_03_02-PM



This was originally posted here.

Comments

*This post is locked for comments