Solved

Find the date the database was last restored

Posted on 2008-10-03
5
496 Views
Last Modified: 2010-04-21
I have MS SQL Server 2005.  Is it possible to find out the date that the database was last restored?
0
Comment
Question by:saturation
  • 3
  • 2
5 Comments
 
LVL 60

Expert Comment

by:chapmandew
ID: 22634747
select distinct physical_device_name,  * from backupfile bf
join backupset bs on bf.backup_set_id = bs.backup_set_id
join backupmediafamily bm on bs.media_set_id = bm.media_set_id
where database_name = 'yourdbname'
order by backup_finish_date desc
0
 
LVL 60

Expert Comment

by:chapmandew
ID: 22634758
sorry...misread.  Look at the create_date in this query:

select * from sys.databases
0
 

Author Comment

by:saturation
ID: 22634829
That shows the created date, but is there a date for the last time a DB was restored into that database?
0
 
LVL 60

Accepted Solution

by:
chapmandew earned 500 total points
ID: 22634909
select * from msdb..restorehistory
0
 

Author Closing Comment

by:saturation
ID: 31502785
Perfect!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question