I'm using sql server 2008, and I would like to know if a specific database has been restored from a device and when did it happened. Is it possible?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
migrated from stackoverflow.com Dec 4 '12 at 13:24
This question came from our site for professional and enthusiast programmers.
In the msdb database, there is a table named restorehistory:
This is a table that people with sufficient privileges can clear out, but if the restore was recent and you don't have a job which clears out this table (or if it hasn't run between then and now), you should be able to see the login which performed the restore.
You can also join it to a couple of other tables (if they have relevant data): backupset and backupmediafamily. If there are records there--with the same retention caveats as before--they'll tell you more about the backup file(s) used to restore:
That way, you could also filter on device type or file location.
Backup and restore histories for SQL Server 2008 are stored in the msdb database restorehistory table. You can query it like so: