Transaction Log Backups (SQL Server)

This topic is relevant only for SQL Server databases that are using the full or bulk-logged recovery models. This topic discusses backing up the transaction log of a SQL Server database.

Minimally, you must have created at least one full backup before you can create any log backups. After that, the transaction log can be backed up at any time unless the log is already being backed up. We recommend that you take log backups frequently, both to minimize work loss exposure and to truncate the transaction log. Typically, a database administrator creates a full database backup occasionally, such as weekly, and, optionally, creates a series of differential database backup at a shorter interval, such as daily. Independently of the database backups, the database administrator backs up the transaction log at frequent intervals, such as every 10 minutes. For a given type of backup, the optimal interval depends on factors such as the importance of the data, the size of the database, and the workload of the server.

In this Topic:

  • How a Sequence of Log Backups Works

  • Recommendations

  • Related Tasks

  • Related Content

How a Sequence of Log Backups Works

The sequence of transaction log backups log chain is independent of data backups. For example, assume the following sequence of events.

Time

Event

8:00 A.M.

Back up database.

Noon

Back up transaction log.

4:00 P.M.

Back up transaction log.

6:00 P.M.

Back up database.

8:00 P.M.

Back up transaction log.

The transaction log backup created at 8:00 P.M. contains transaction log records from 4:00 P.M. through 8:00 P.M., spanning the time when the full database backup was created at 6:00 P.M. The sequence of transaction log backups is continuous from the initial full database backup created at 8:00 A.M. to the last transaction log backup created at 8:00 P.M. For information about how to apply these log backups, see the example in Apply Transaction Log Backups (SQL Server).

[Top]

Recommendations

  • If a transaction log is damaged, work that is performed since the most recent valid backup is lost. Therefore we strongly recommend that you put your log files on fault-tolerant storage.

  • If a database is damaged or you are about to restore the database, we recommend that you create a tail-log backup to enable you to restore the database to the current point in time.

  • By default, every successful backup operation adds an entry in the SQL Server error log and in the system event log. If back up the log very frequently, these success messages accumulate quickly, resulting in huge error logs that can make finding other messages difficult. In such cases you can suppress these log entries by using trace flag 3226 if none of your scripts depend on those entries. For more information, see Trace Flags (Transact-SQL).

To create a transaction log backup

To schedule backup jobs, see Use the Maintenance Plan Wizard.

[Top]

None.

[Top]

See Also

Concepts

The Transaction Log (SQL Server)

Back Up and Restore of SQL Server Databases

Tail-Log Backups (SQL Server)

Apply Transaction Log Backups (SQL Server)