Menu & Search
Get Last Database Restore DateTimes in SQL Server

Get Last Database Restore DateTimes in SQL Server

This post is a guide on how to get the DateTimes for when your databases were last restored in SQL Server.

The script below queries the M.S.D.B database sys.databases and restorehistory tables. Please search Online for every table you query in SQL Server, find the Microsoft Documentation and have it to hand when building queries.

If your database was not created by a RESTORE procedure then the restore_date column value will be NULL. For example, if you’ve installed SQL Server and created a new database, then this script may not be of much use.

database last restore time sql

The above restore_type column shows D for a Full backup restore, and L indicates a TLog restore. As mentioned, MS Docs for more info.