zoukankan      html  css  js  c++  java
  • Log Reuse Waits Explained: DATABASE_MIRRORING

    From:http://sqlity.net/en/1843/log-reuse-waits-explained-database_mirroring/

    Introduction

    There are eight reasons SQL Server might report when it cannot truncate the transaction log. Any one of these reasons results in a growing log file. This short series is looking at each of them in detail, explaining what is causing it and what you can do to resolve it. Today's log reuse wait reason is: DATABASE_MIRRORING

    Database Mirroring

    Database mirroring is deprecated since SQL Server 2012. So this wait type will go away at some point. But for now there are still quite a few installations out there. Therefore I decided to cover it anyway.

    Database mirroring allows you to have a second exact copy of your database on a different server. There are two operating modes: high performance and high-safety. In high-safety mode a transaction can only be committed if it has been applied to both databases. This can cause higher transaction latency but you will not lose any data if one of the two servers suddenly dies.

    In high-performance mode on the other hand, transactions are committed on the primary server first and then transferred over to the secondary server. That reduces the latency impact on the primary server, but you might run the risk of some data loss if the secondary is behind at the time the primary server goes down.

    Waiting for the Secondary

    If you set database mirroring up in high-performance mode, a background process reads records for committed transaction from the transaction log and then sends enough information over to the secondary to repeat the action that transaction executed.

    If the secondary falls behind, for example because of an interrupted network connection, the log reading process will wait until it can continue to transmit transaction information. During that time, transactions in the log that have not been processed by the mirroring agent cannot be purged and the virtual log files containing these records can't be reused. SQL Server will return a log_reuse_wait_desc value of DATABASE MIRRORING if it runs out of virtual log files because of this.

    To solve this issue make sure the server housing the database mirror is adequately sized to keep up with the transaction load and the network connection between the two is stable. Also make sure there is enough room for the transaction log of the source database to grow in case of a mirror delay.

    Summary

    SQL Server database mirroring is a deprecated high availability solution. It allows us to have copy of a database on a secondary server that is automatically kept in synch, either synchronously or asynchronously. In high-performance mode, the transaction log information of committed transactions is used to apply the changes asynchronously to the secondary. A log_reuse_wait_descvalue of DATABASE MIRRORING indicates that this process is falling behind and can't process log records quickly enough.

    The high-safety mode on the other hand applies all changes synchronously and therefore has no impact on transaction log reuse.

  • 相关阅读:
    邀您参加 | BigData & Alluxio 交流会-成都站
    mongodb之使用explain和hint性能分析和优化
    mongodb 3.x 之实用新功能窥看[2] ——使用$lookup做多表关联处理
    mongodb 3.x 之实用新功能窥看[1] ——使用TTLIndex做Cache处理
    asp.net mvc 之旅 —— 第六站 ActionFilter的应用及源码分析
    asp.net mvc 之旅 —— 第五站 从源码中分析asp.net mvc 中的TempData
    分布式架构中一致性解决方案——Zookeeper集群搭建
    搭建高可用的redis集群,避免standalone模式带给你的苦难
    asp.net mvc 之旅—— 第四站 学会用Reflector调试我们的MVC框架代码
    使用强大的可视化工具redislive来监控我们的redis,别让自己死的太惨~~~
  • 原文地址:https://www.cnblogs.com/roseHLF/p/9046099.html
Copyright © 2011-2022 走看看