Tag Archives: database restore

How to: Find Database Restore History

The following query will help you to track back when the database was restore and which backed up file was used to restore for the particular database.

USE msdb;
GO
SELECT
    DBRestored = destination_database_name,
    SourceDB = b.database_name,
    SourceFile = physical_name,
    BackupDate = backup_start_date,
    RestoreDate = restore_date
FROM RestoreHistory h
INNER JOIN BackupSet b
 ON h.backup_set_id = b.backup_set_id
INNER JOIN BackupFile f
 ON f.backup_set_id = b.backup_set_id
ORDER BY RestoreDate
GO

How to: Find The Last Restore Data For A Database

Execute the following Microsoft SQL Server T-SQL scripts in Management Studio Query Editor to find the database restore dates:

USE MSDB;
GO
SELECT
      DBRestored  = destination_database_name,
      RestoreDate = restore_date,
      SourceDB    = b.database_name,
      SourceFile  = physical_name,
      BackupDate  = backup_start_date
FROM RestoreHistory h
INNER join BackupSet b
      ON h.backup_set_id = b.backup_set_id
INNER join BackupFile f
      ON f.backup_set_id = b.backup_set_id
ORDER by RestoreDate
GO

Refer to my previous post on how to get database backup history for single database.

How to: Restore Database Backup Using SQL Script (T-SQL)

Besides using the GUI to restore your database, you can try using T-SQL scripts to restore your database from your logical disk.

RESTORE DATABASE [YourDatabaseName]
FROM DISK = 'D:\YourDBFullBackupFile.bak'
WITH STATS = 10

I come across another method from SQLAuthority.com.

RESTORE FILELISTONLY
FROM DISK = 'D:\YourDBFullBackupFile.bak'