{"id":1143,"date":"2007-10-25T17:04:00","date_gmt":"2007-10-25T17:04:00","guid":{"rendered":"\/blogs\/paul\/post\/Search-Engine-QA-8-How-can-defragging-an-index-break-synchronous-mirroring-And-what-happens.aspx"},"modified":"2017-04-13T09:52:07","modified_gmt":"2017-04-13T16:52:07","slug":"search-engine-qa-8-how-can-defragging-an-index-break-synchronous-mirroring-and-what-happens","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/paul\/search-engine-qa-8-how-can-defragging-an-index-break-synchronous-mirroring-and-what-happens\/","title":{"rendered":"Search Engine Q&#038;A #8: How can defragging an index break synchronous mirroring? And what happens?"},"content":{"rendered":"<p><font face=\"Verdana\"><font size=\"2\"><\/p>\n<p>\n<em>(Been a few days since I posted &#8211; had some real work to do :-) Today I&#39;ll post a few things from the queue that&#39;s&nbsp;been building up)<\/em>\n<\/p>\n<p>\nThis is part Q&amp;A and part follow-on from my <a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/more-on-database-mirroring-performance-and-index-maintenance\/\" target=\"_blank\">last post<\/a> about running index maintenance when a database is mirrored.\n<\/p>\n<p>\nA customer has a maintenance plan that involves running regular <font face=\"Courier New\">ALTER INDEX &#8230; REORGANIZE<\/font> on a 100GB clustered index to remove fragmentation. Three weeks ago they added database mirroring, with the database setup for synchronous mirroring. Every so often, they see the state of the mirror change from <font face=\"Courier New\">SYNCHRONIZED<\/font> to <font face=\"Courier New\">SYNCHRONIZING<\/font> and then a bit later back to <font face=\"Courier New\">SYNCHRONIZED<\/font>. What&#39;s going on? Once a synchronously-mirrored database is synchronized, it should ever get out of sync, right?\n<\/p>\n<p>\nWell not quite &#8211; if the communication link between the principal and the mirror is broken, then the mirror becomes unsynchronized. The exact behavior in this situation depends on how mirroring is setup and what&#39;s failed:\n<\/p>\n<ol>\n<li>If there&#39;s no witness instance, then transactions will continue on the principal database but the transaction log starts to grow, because the transactions can&#39;t be cleared from the principal&#39;s log (even after a log backup) until they&#39;ve been sent to the mirror. The database is running &#39;exposed&#39;. Once the link is reestablished, the mirror while synchronize again. <\/li>\n<li>If there&#39;s a witness, and the witness can still talk to the principal, then everything continues as in #1 <\/li>\n<li>If there&#39;s a witness, and the communication link between it and principal is also broken, the the principal will stop serving the database &#8211; transactions will stop. In this case, if the mirror and the witness can still see each other, then a failover will occur.<\/li>\n<\/ol>\n<p>\nThere are some great Books Online entries that describe all of this &#8211; see <a href=\"https:\/\/msdn.microsoft.com\/Areas\/Epx\/Content\/500.htm?aspxerrorpath=\/en-us\/library\/ms179344.aspx\">http:\/\/msdn2.microsoft.com\/en-us\/library\/ms179344.aspx<\/a>&nbsp;to start with.\n<\/p>\n<p>\nThe customer had situation #1. Every so often the mirror would change state and it seemed to coincide with the defrag job. Looking in the error log shows messages like:\n<\/p>\n<blockquote dir=\"ltr\" style=\"margin-right: 0px\">\n<p style=\"margin: 0in 0in 0pt\" class=\"MsoNormal\">\n\t<span style=\"font-family: Arial; color: navy; font-size: 10pt\"><font face=\"Courier New\">2007-10-24 11:43:36.21 spid23s&nbsp;&nbsp;&nbsp;&nbsp; Error: 1474, Severity: 16, State: 1.<\/font><\/span>\n\t<\/p>\n<p style=\"margin: 0in 0in 0pt\" class=\"MsoNormal\">\n\t<span style=\"font-family: Arial; color: navy; font-size: 10pt\"><font face=\"Courier New\">2007-10-24 11:43:36.21 spid23s&nbsp;&nbsp;&nbsp;&nbsp; Database mirroring connection error 2 &#39;Connection attempt failed with error: &#39;10060(A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)&#39;.&#39; for &#39;TCP:\/\/roadrunnerpr.sqlskills.com:5022&#39;.<\/font><\/span>\n\t<\/p>\n<\/blockquote>\n<p>\nSo the network link was dying sometimes when the defrag was running &#8211; that explains the switch between <font face=\"Courier New\">SYNCHRONIZED<\/font> and <font face=\"Courier New\">SYNCHRONIZING<\/font>. Why the network link was dying is still under investigation but it seems like the additional transaction log generated by the defrag job was causing the network to become overloaded and some component of it wasn&#39;t behaving correctly under load.\n<\/p>\n<p>\nThere are a few things to learn from this:\n<\/p>\n<ol>\n<li>Not only do you need to make sure that your IO subsystem can handle the load on it correctly, you also need to make sure your network can handle the load on it. There are a bunch of tools available to stress-test network paths &#8211; one simple one is TrafficEmulator. <\/li>\n<li>When you&#39;re running on your test system before going into production, make sure you test *everything* as if you were running in production &#8211; including maintenance jobs because they can add significant load to a production system. <\/li>\n<li>When you implement an HA solution such as mirroring, consider all the ways that transaction log will be generated when figuring out the required network bandwidth to support your HA configuration &#8211; something like a defrag or rebuild can cause an enormous spike in log generation<\/li>\n<\/ol>\n<p><\/font><\/font><\/p>\n","protected":false},"excerpt":{"rendered":"<p>(Been a few days since I posted &#8211; had some real work to do :-) Today I&#39;ll post a few things from the queue that&#39;s&nbsp;been building up) This is part Q&amp;A and part follow-on from my last post about running index maintenance when a database is mirrored. A customer has a maintenance plan that involves [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31,32,78],"tags":[],"class_list":["post-1143","post","type-post","status-publish","format-standard","hentry","category-database-maintenance","category-database-mirroring","category-search-engine-q-and-a"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Search Engine Q&amp;A #8: How can defragging an index break synchronous mirroring? And what happens? - Paul S. Randal<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/search-engine-qa-8-how-can-defragging-an-index-break-synchronous-mirroring-and-what-happens\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Search Engine Q&amp;A #8: How can defragging an index break synchronous mirroring? And what happens? - Paul S. Randal\" \/>\n<meta property=\"og:description\" content=\"(Been a few days since I posted &#8211; had some real work to do :-) Today I&#039;ll post a few things from the queue that&#039;s&nbsp;been building up) This is part Q&amp;A and part follow-on from my last post about running index maintenance when a database is mirrored. A customer has a maintenance plan that involves [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/paul\/search-engine-qa-8-how-can-defragging-an-index-break-synchronous-mirroring-and-what-happens\/\" \/>\n<meta property=\"og:site_name\" content=\"Paul S. Randal\" \/>\n<meta property=\"article:published_time\" content=\"2007-10-25T17:04:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-13T16:52:07+00:00\" \/>\n<meta name=\"author\" content=\"Paul Randal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Paul Randal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/search-engine-qa-8-how-can-defragging-an-index-break-synchronous-mirroring-and-what-happens\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/search-engine-qa-8-how-can-defragging-an-index-break-synchronous-mirroring-and-what-happens\/\",\"name\":\"Search Engine Q&A #8: How can defragging an index break synchronous mirroring? And what happens? - Paul S. Randal\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\"},\"datePublished\":\"2007-10-25T17:04:00+00:00\",\"dateModified\":\"2017-04-13T16:52:07+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/search-engine-qa-8-how-can-defragging-an-index-break-synchronous-mirroring-and-what-happens\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/paul\/search-engine-qa-8-how-can-defragging-an-index-break-synchronous-mirroring-and-what-happens\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/search-engine-qa-8-how-can-defragging-an-index-break-synchronous-mirroring-and-what-happens\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Search Engine Q&#038;A #8: How can defragging an index break synchronous mirroring? And what happens?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\",\"name\":\"Paul S. Randal\",\"description\":\"In Recovery...\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\",\"name\":\"Paul Randal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"caption\":\"Paul Randal\"},\"sameAs\":[\"http:\/\/3.209.169.194\/blogs\/paul\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Search Engine Q&A #8: How can defragging an index break synchronous mirroring? And what happens? - Paul S. Randal","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/paul\/search-engine-qa-8-how-can-defragging-an-index-break-synchronous-mirroring-and-what-happens\/","og_locale":"en_US","og_type":"article","og_title":"Search Engine Q&A #8: How can defragging an index break synchronous mirroring? And what happens? - Paul S. Randal","og_description":"(Been a few days since I posted &#8211; had some real work to do :-) Today I&#39;ll post a few things from the queue that&#39;s&nbsp;been building up) This is part Q&amp;A and part follow-on from my last post about running index maintenance when a database is mirrored. A customer has a maintenance plan that involves [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/paul\/search-engine-qa-8-how-can-defragging-an-index-break-synchronous-mirroring-and-what-happens\/","og_site_name":"Paul S. Randal","article_published_time":"2007-10-25T17:04:00+00:00","article_modified_time":"2017-04-13T16:52:07+00:00","author":"Paul Randal","twitter_misc":{"Written by":"Paul Randal","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/search-engine-qa-8-how-can-defragging-an-index-break-synchronous-mirroring-and-what-happens\/","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/search-engine-qa-8-how-can-defragging-an-index-break-synchronous-mirroring-and-what-happens\/","name":"Search Engine Q&A #8: How can defragging an index break synchronous mirroring? And what happens? - Paul S. Randal","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website"},"datePublished":"2007-10-25T17:04:00+00:00","dateModified":"2017-04-13T16:52:07+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/search-engine-qa-8-how-can-defragging-an-index-break-synchronous-mirroring-and-what-happens\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/paul\/search-engine-qa-8-how-can-defragging-an-index-break-synchronous-mirroring-and-what-happens\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/search-engine-qa-8-how-can-defragging-an-index-break-synchronous-mirroring-and-what-happens\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/paul\/"},{"@type":"ListItem","position":2,"name":"Search Engine Q&#038;A #8: How can defragging an index break synchronous mirroring? And what happens?"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/","name":"Paul S. Randal","description":"In Recovery...","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce","name":"Paul Randal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","caption":"Paul Randal"},"sameAs":["http:\/\/3.209.169.194\/blogs\/paul"],"url":"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/1143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/comments?post=1143"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/1143\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/media?parent=1143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/categories?post=1143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/tags?post=1143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}