SQL SERVER – What is Tail-Log Backups?

Tail-Log Backups capture the end of an available transaction log before a restore. I assess them within the intended recovery chain.

The connected final rope section is gathered beside preserved earlier sections and a separate restraint.

A tail-log backup can preserve transactions committed after the last log backup. The example concerns an online database in full or bulk-logged recovery. A usable data backup and log chain are required. Simple recovery does not support transaction log backups.

-- Planned restore template only: this takes the source database out of service.
-- BACKUP LOG [SQLAuthority]
-- TO DISK = N'D:\SQLBackups\SQLAuthority_tail.trn'
-- WITH NORECOVERY, STATS = 10;

WITH NORECOVERY leaves the source database restoring, preventing further transactions. That changes availability. Coordinate it with the restore plan and required exclusive access.

  1. Restore the selected full backup with NORECOVERY.
  2. Restore an applicable differential backup with NORECOVERY, if one is part of the plan.
  3. Restore the required subsequent log backups in LSN order, including the tail-log backup.
  4. Recover the database at the intended point, using RECOVERY on the final restore when appropriate.

A differential backup can change the required starting point for log restores. Damaged databases have additional restrictions, and bulk-logged changes can limit recoverability. The log may be unavailable. An intentionally earlier recovery point may not require a tail-log backup.

Reference: Tail-log scenarios and restore restrictions.

A tail-log backup is not always possible or necessary, it is a recovery step determined by the restore scenario.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.


Discover more from SQL Authority with Pinal Dave

Subscribe to get the latest posts sent to your email.

SQL Backup and Restore, SQL Scripts, SQL Server
Previous Post
SQL SERVER – Error 1324. The folder path ‘Program Files’ contains an invalid character.
Next Post
SQL SERVER – What is Forwarded Records and How to Fix Them?

Related Posts

11 Comments. Leave new

  • Tail log back was introduced in sql server 2000 we can take it with norecovery or with standby it depends.

    Reply
  • I have T-log backup scheduled for every 30mins and client deleted the data by 4:04PM can I get the data back by taking tail backup…???

    Reply
  • aravind hariharaputran
    May 2, 2019 1:48 am

    so Tail log backup essentially has to have “NO_TRUNCATE” . I dont see that in the command at all ? Is my understanding wrong ?

    Reply
  • What is the mean of “WITH Continue_After_Error”

    Reply
  • This one feature confuses me often as I try to think of a scenario where I have to restore over an existing database. The only time I would have to restore over an existing database is if it got corrupted or unoperable. How do you carry out a log backup if it’s corrupted or not operable? If not, wouldn’t you just kick off your log backup job instead with it’s proper naming convention?

    Reply
  • Can I take the tail log back up immediately after the full backup to restore it on another server rather than taking differential and transaction log backup, also if I am not taking .diff and .trn than directly taking tail backup after full backup will that be a good option for not missing any transactions ?

    Reply
  • According to my knowledge, you need to take a tran after full and restore it. That’s what I do usually

    Reply
  • This article help full for me.
    Thanks

    Reply
  • In a scenario where we’re migrating a db to a new server, if I have the app shut down and do a CHECKPOINT of the db followed by a full backup, do I still need to do a tail-log backup?

    Reply
  • NO_TRUNCATE is compulsory right in TAIL log backup?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.