This script returns information about the last time a database has been restored on this server.
You can either search all databases by leaving the parameter NULL or search for a single specific database.
The other configurable item is the time frame to look for. It defaults to 30 days, and it should be entered as a negative number (i.e., -7)
This script queries the MSDB database, so it'll return what's on the history only
Source: MSSQL SQL Tips
/* DESCRIPTION: Queries the RESTORE operation that have taken place in the last 30 days CONFIGURATION Compatibility list: MSSQL2012 MSSQL2008 MSSQL2005 DOES NOT WORK UNKNOWN: MSSQL2000 */ DECLARE @dbname sysname, @days int SET @dbname = NULL --substitute for whatever database name you want SET @days = -30 --previous number of days, script will default to 30 SELECT rsh.destination_database_name AS [Database], rsh.user_name AS [Restored By], CASE WHEN rsh.restore_type = 'D' THEN 'Database' WHEN rsh.restore_type = 'F' THEN 'File' WHEN rsh.restore_type = 'G' THEN 'Filegroup' WHEN rsh.restore_type = 'I' THEN 'Differential' WHEN rsh.restore_type = 'L' THEN 'Log' WHEN rsh.restore_type = 'V' THEN 'Verifyonly' WHEN rsh.restore_type = 'R' THEN 'Revert' ELSE rsh.restore_type END AS [Restore Type], rsh.restore_date AS [Restore Started], bmf.physical_device_name AS [Restored From], rf.destination_phys_name AS [Restored To], bs.server_name AS [CameFromServer] FROM msdb.dbo.restorehistory rsh INNER JOIN msdb.dbo.backupset bs ON rsh.backup_set_id = bs.backup_set_id INNER JOIN msdb.dbo.restorefile rf ON rsh.restore_history_id = rf.restore_history_id INNER JOIN msdb.dbo.backupmediafamily bmf ON bmf.media_set_id = bs.media_set_id WHERE rsh.restore_date >= DATEADD(dd, ISNULL(@days, -30), GETDATE()) --want to search for previous days AND destination_database_name like ISNULL(@dbname, '%') --if no dbname, then return all and rf.file_number = 1 --- Only lists MDF ORDER BY rsh.restore_history_id DESC GO