Technical Article

Script to Get the Database Restore history

,

This script will get the database restore history details including the files from which the database is restored.

USE [msdb]
GO
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	[dbo].[restorehistory] rs
JOIN	[dbo].[backupset] bs
	ON rs.[backup_set_id] = bs.[backup_set_id]
JOIN	[dbo].[backupmediafamily] bmf
	ON bs.[media_set_id] = bmf.[media_set_id]
ORDER BY rs.[restore_date] DESC
GO

Rate

5 (2)

You rated this post out of 5. Change rating

Share

Share

Rate

5 (2)

You rated this post out of 5. Change rating