Database mirroring is the creation and maintenance of redundant copies of a database. The purpose is to ensure continuous data availability and minimize or avoid downtime that might otherwise result from data corruption or loss, or from a situation when the operation of a network is partially compromised. Redundancy also ensures that at least one viable copy of a database will always remain accessible during system upgrades.
Database mirroring is used by Microsoft SQL Server, a relational database management system (RDBMS) designed for the enterprise environment. Two copies of a single database reside on different computers called server instances, usually in physical locations separated by some distance. The principal (or primary) server instance provides the database to clients. The mirror (or secondary) server instance acts as a standby that can take over in case of a problem with the principal server instance.
If 100-percent accuracy is required, database mirroring requires that the mirror server instance always stay current; in other words, the system must immediately copy every change in the principal's content to the mirror and vice-versa. In this mode, known as synchronous operation, the mirror is called a hot standby. While database mirroring can also work when the content is not fully synchronized, some data loss may occur if one of the server instances fails or becomes inaccessible. In this mode, called asynchronous operation, the mirror is called a warm standby.
The principal advantage of synchronous operation (with a hot standby) is a guarantee that both server instances contain identical information. However, this guarantee requires more frequent updates, resulting in latency that can slow down performance to an extent that some users may find unacceptable. The principal advantage of asynchronous operation (with a warm standby) is faster performance, but at the expense of the guarantee of identical information in both server instances at all times.