Thursday 2 August 2012

How To Find Find Database Restore History



Here is the script for finding the database restore history in SQL Server.

USE msdb;
GO
Select
DBRestored = destination_database_name,
RestoreDate = restore_date,
SourceDB = b.database_name,
SourceFile = physical_name,
BackupDate = backup_start_date
from RestoreHistory h
inner join BackupSet b
on h.backup_set_id = b.backup_set_id
inner join BackupFile f
on f.backup_set_id = b.backup_set_id
order by RestoreDate
GO

No comments:

Post a Comment