Finding Last Restored database in Sql Server Database.

vishalneeraj-24503
Posted by vishalneeraj-24503 under Sql Server category on | Points: 40 | Views : 183
Write below query:-
SELECT [RS].[Destination_Database_Name] AS [Destination_DB_Name],
[RS].[Restore_Date] AS [Restore_Date],
[BS].[Backup_Start_Date] AS [Backup_Start_Date],
[BS].[Backup_Finish_Date] AS [Backup_End_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;

Comments or Responses

Login to post response