Saturday, August 13, 2011

Find the datbase restore history for your server

-- Find the restore history for your database

use msdb
select rh.restore_history_id ,rh.restore_date, rh.user_name, rh.destination_database_name,
rh.restore_type,rf.restore_history_id, rf.file_number, rf.destination_phys_drive,rf.destination_phys_name
from restorehistory rh
join restorefile rf
on rh.restore_history_id = rf.restore_history_id
where rh.destination_database_name = 'mytestdb'
order by rh.restore_date desc

-- Please note Restore_Type value D = Full and L= Log

No comments: