Tuesday, January 11, 2011

Log Shipping vs. database mirroring

Database mirroring is functionality in the SQL Server engine that reads from the transaction log and copies transactions from the principal server instance to the mirror server instance.  It can operate synchronously or asynchronously. If configured to operate synchronously, the transaction on the principal will not be committed until it is hardened to disk on the mirror. Database mirroring supports only one mirror for each principal database. Database mirroring also supports automatic failover if the principal database becomes unavailable.  The mirror database is always offline in a recovering state, but you can create snapshots of the mirror database to provide read access for reporting, etc.

Log shipping is based on SQL Server Agent jobs that periodically take log backups of the primary database, copy the backup files to one or more secondary server instances, and restore the backups into the secondary database(s).  Log shipping supports an unlimited number of secondaries for each primary database.In case of a failover, we have to manually bring one of the secondaries online and this may increase the data recovery time.

Database mirroring is preferable to log shipping in most cases, although log shipping does have the following advantages:

  1. it provides backup files as part of the process
  2. multiple secondaries are supported
  3. it is possible to introduce a fixed delay when applying logs to allow the secondary to be used for  recovering from user error.
  4. it work in low bandwidth
  5. the secondary database can be in Stand-By mode, which can be used for reporting purposes

 

More information about both technologies is available in SQL Server Books Online in the topics "Understanding Log Shipping" and "Overview of Database Mirroring".

0 comments:

Post a Comment