Database mirroring is a simple strategy that offers the following benefits:
- Increases availability of a database.
In the event of a disaster, in high-safety mode with automatic failover, failover quickly brings the standby copy of the database online (without data loss). In the other operating modes, the database administrator has the alternative of forcing service (with possible data loss) to the standby copy of the database.
- A database mirroring partner running on SQL Server 2008 Enterprise or later versions automatically tries to resolve certain types of errors that prevent reading a data page. The partner that is unable to read a page requests a fresh copy from the other partner. If this request succeeds, the unreadable page is replaced by the copy, which usually resolves the error.
- Improves the availability of the production database during upgrades.
To minimize downtime for a mirrored database, you can sequentially upgrade the instances of SQL Server that are hosting the failover partners. This will incur the downtime of only a single failover. This form of upgrade is known as a rolling upgrade.
Database Mirroring Terms and Definitions
automatic failover
The process by which, when the principal server becomes unavailable, the mirror server to take over the role of principal server and brings its copy of the database online as the principal database.
failover partners
The two server instances (the principal server or the mirror server) that act as role-switching partners for a mirrored database.
forced service
A failover initiated by the database owner upon the failure of the principal server that transfers service to the mirror database while it is in an unknown state.
High-performance mode
The database mirroring session operates asynchronously and uses only the principal server and mirror server. The only form of role switching is forced service (with possible data loss).
High-safety mode
The database mirroring session operates synchronously and, optionally, uses a witness, as well as the principal server and mirror server.
manual failover
A failover initiated by the database owner, while the principal server is still running, that transfers service from the principal database to the mirror database while they are in a synchronized state.
mirror database
The copy of the database that is typically fully synchronized with the principal database.
mirror server
In a database mirroring configuration, the server instance on which the mirror database resides.
principal database
In database mirroring, a read-write database whose transaction log records are applied to a read-only copy of the database (a mirror database).
principal server
In database mirroring, the partner whose database is currently the principal database.
redo queue
Received transaction log records that are waiting on the disk of a mirror server.
role
The principal server and mirror server perform complementary principal and mirror roles. Optionally, the role of witness is performed by a third server instance.
role switching
The taking over of the principal role by the mirror.
send queue
Unsent transaction log records that have accumulated on the log disk of the principal server.
session
The relationship that occurs during database mirroring among the principal server, mirror server, and witness server (if present).
After a mirroring session starts or resumes, the process by which log records of the principal database that have accumulated on the principal server are sent to the mirror server, which writes these log records to disk as quickly as possible to catch up with the principal server.
Transaction safety
A mirroring-specific database property that determines whether a database mirroring session operates synchronously or asynchronously. There are two safety levels: FULL and OFF.
Witness
For use only with high-safety mode, an optional instance of SQL Server that enables the mirror server to recognize when to initiate an automatic failover. Unlike the two failover partners, the witness does not serve the database. Supporting automatic failover is the only role of the witness.