In SQL Server Log Shipping and Mirroring can work together to provide solutions for high availability and disaster recovery. We can convert an existing log shipping configuration to a database mirroring configuration and also easily switch which pair of instances is using database mirroring and which instances are configured with log shipping.
SQL Server Database Mirroring
To move the database transactions from one SQL Server database (Principal database) to another SQL Server database (Mirror database) on a different instance the database mirroring is used. If the principal server fails, the mirror server automatically becomes the new principal server and recovers the principal database using a witness server under high-availability mode. It is a mixture of replication and log shipping. Mirroring works only with the full recovery model.
Logical Design Diagram of Database Mirroring
Difference between the Database Mirroring and Log Shipping
| MIRRORING | LOG SHIPPING |
| 1. It is limited to only two Servers | 1.In this we can log ship to multiple Servers |
| 2. Mirroring with a Witness Server allows for High Availability and automatic fail over. | 2. Log shipping is only as current as how often the job runs. If we ship logs every 15 minutes, the secondary server could be as far as 15 minutes. Making it more of a Warm Standby. |
| 3. We can configure our DSN string to have both mirrored servers in it so that when they switch we notice nothing. | 3. We can leave the database in read only mode while it is being updated. Good for reporting servers. |
| 4. While mirrored, our Mirrored Database cannot be accessed. It is in Synchronizing/Restoring mode. | 4. Good for disaster recovery |
| 5. Mirroring with SQL Server 2005 standard edition is not good for load balancing |
|
Things that are explained in this article
- Roles Of the Server
- Modes of Database Mirroring
- Loss of Servers
- Prerequisites
- Restrictions
- Endpoints
- Creating a mirror database for mirroring
- Database Mirroring
Roles of the Server in Database Mirroring
-
Principal server
The principal server hosts the active copy of the database (referred to as the principal database) and services client requests. The principal server forwards all transactions to the mirror server before it applies them in the principal database.
-
Mirror server
The mirror server hosts a copy of the principal database (referred to as the mirror database) and applies the transactions forwarded by the principal database to keep the mirror database synchronized with the principal database.
-
Witness server
The witness server is an optional component of a database mirroring solution. When present, a witness server monitors the principal and mirror servers to ensure continued connectivity and participation in the mirror session (referred to as quorum). If either server loses quorum, the witness server assigns the principal server role, causing automatic failover from the principal server to the mirror server if necessary. A witness server is required for automatic failover; however, one witness server can support several mirror sessions because it is not an intensive job.
Database Mirroring Modes
Database Mirroring has three different Modes



Hadshana KamalanathanPosted Sep 3, 2018, 1:23 PM
Nice article thank you for sharing...
sayed bashaPosted Nov 18, 2016, 2:01 AM
Good article, Could you please post AlwaysOn concept also
Gowtham RajamanickamPosted Apr 17, 2016, 7:15 AM
Very good
Nipun TomarPosted Mar 4, 2014, 11:08 PM
Thanks to all.
Jean PaulPosted Mar 3, 2014, 8:11 PM
Super Article! :)
Veena SardaPosted May 9, 2013, 7:22 AM
Explained very well. A comment of on High Performance Mode Failover type - It is Manual. and for Hgh Protection - some reconfiguration needs to be done to bring it online.