Skip to content

Instantly share code, notes, and snippets.

@DavidBrower
Last active May 19, 2018 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidBrower/c085e60735a5a61214757223f21621e0 to your computer and use it in GitHub Desktop.
Save DavidBrower/c085e60735a5a61214757223f21621e0 to your computer and use it in GitHub Desktop.
Get SQL Server Restore Information
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment