Tuesday, January 13, 2015

Script to find out the last restore date

use msdb;
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
where h.destination_database_name='DB_NameHere'
order by RestoreDate desc
go
 

Labels: , ,

0 Comments:

Post a Comment

<< Home