Last Transaction Log File Restored

  • I had a scenario the other day where we restored a FULL with NORECOVERY, then restored the latest DIFFERENTIAL with NORECOVERY and proceeded to restore about 50 tran logs. This is a very large database and I was restoring the tran logs in increments of 10 (number of restore commands I would highlight at one time). I got distracted and could not remember the file name of the last restored transaction log.

    Is there a system table that will tell me the file name of the last transaction log restored?

    Thanks in advance for your help

  • Maybe you can query restorehistory and join to backup tables using backup_set_id and restore_type to see the most recent restore. Too busy to dig any deeper right now.

    What did you do ? Just try various t-logs until you found one that didn't fail due to being out of sequence ?

  • Try this script, change your dbname in @dbname variable

    DECLARE @dbname VARCHAR(100)

    SET @dbname='YourDBName'

    SELECT * FROM restorehistory

    WHERE destination_database_name=@dbname AND restore_type='L' ORDER BY restore_date DESC

  • Please let us know if you are able to restore your database.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply