How to: Create a Transaction Log Backup (Transact-SQL)

This topic explains how to create a transaction log backup using a BACKUP LOG statement.

To create a transaction log backup

  1. Execute the BACKUP LOG statement to back up the transaction log, specifying the following:

    • The name of the database to which the transaction log that you want to back up belongs.
    • The backup device where the transaction log backup is written.
  2. Optionally, specify:

    • The INIT clause to overwrite the backup media, and write the backup as the first file on the backup media. If no existing media header exists, one is automatically written.

    • The SKIP and INIT clauses to overwrite the backup media even if there are either backups on the backup media that have not yet expired, or the media name does not match the name on the backup media.

    • The FORMAT clause, when you are using media for the first time, to initialize the backup media and rewrite any existing media header.
      The INIT clause is not required if the FORMAT clause is specified.


      Use extreme caution when you are using the FORMAT or INIT clauses of the BACKUP statement as this destroys any backups previously stored on the backup media.



The MyAdvWorks_FullRM database is a copy of AdventureWorks, which uses the simple recovery model. To permit log backups, before taking a full database backup, the database was set to use the full recovery model by using: ALTER DATABASE MyAdvWorks_FullRM SET RECOVERY FULL.

This example creates a transaction log backup for the MyAdvWorks_FullRM database to the previously created named backup device, MyAdvWorks_FullRM_log1.

   TO MyAdvWorks_FullRM_log1

See Also


How to: Back Up a Transaction Log (SQL Server Management Studio)
How to: Apply a Transaction Log Backup (Transact-SQL)


Optimizing Backup and Restore Performance in SQL Server
Full File Backups
Working with Transaction Log Backups

Other Resources

BACKUP (Transact-SQL)
Restoring a Database to a Point Within a Backup
SQL Server Management Studio Tutorial

Help and Information

Getting SQL Server 2005 Assistance