Transaction log mirrors

A transaction log mirror is an identical copy of the transaction log, maintained at the same time as the transaction log. If a database has a transaction log mirror, every database change is written to both the transaction log and the transaction log mirror. By default, databases do not have transaction log mirrors.

A transaction log mirror provides extra protection for critical data. It enables complete data recovery in the case of media failure on the transaction log. A transaction log mirror also enables a database server to perform automatic validation of the transaction log on database startup.

It is recommended that you use a transaction log mirror when running high-volume or critical applications. For example, at a consolidated database in a SQL Remote setup, replication relies on the transaction log, and if the transaction log is damaged or becomes corrupt, data replication can fail.

If you are using a transaction log mirror, and an error occurs while trying to write to one of the logs (for example, if the disk is full), the database server stops. The purpose of a transaction log mirror is to ensure complete recoverability in the case of media failure on either log device; this purpose would be lost if the server continued with a single transaction log.

You can specify the -fc option when starting the database server to implement a callback function when the database server encounters a file system full condition. See -fc server option.

Where to store the transaction log mirror

There is a performance penalty for using a transaction log mirror because each database log write operation must be performed twice. The performance penalty depends on the nature and volume of database traffic and on the physical configuration of the database and logs.

A transaction log mirror should be kept on a separate device from the transaction log. This improves performance, and if either device fails, the other copy of the log keeps the data safe for recovery.

Alternatives to a transaction log mirror

Alternatives to a transaction log mirror are to use the following configurations:

  • database mirroring. See Introduction to database mirroring.

  • a disk controller that provides hardware mirroring. Generally, hardware mirroring is more expensive than operating-system level software mirroring, but it provides better performance.

  • operating-system level software mirroring, as provided by Microsoft Windows.

Live backups provide additional protection with some similarities to using a transaction log mirror. See Differences between live backups and transaction log mirrors.

For information about creating a database with a transaction log mirror, see Initialization utility (dbinit).

For information about changing an existing database to use a transaction log mirror, see Transaction Log utility (dblog).