{"id":1520,"date":"2012-06-27T20:20:48","date_gmt":"2012-06-27T22:20:48","guid":{"rendered":"http:\/\/fabriciolima.net\/blog\/?p=1520"},"modified":"2016-07-24T10:23:00","modified_gmt":"2016-07-24T13:23:00","slug":"database-mirroring-operation-mode-high-safety-without-failover-parte-1","status":"publish","type":"post","link":"https:\/\/fabriciolima.net\/blog\/2012\/06\/27\/database-mirroring-operation-mode-high-safety-without-failover-parte-1\/","title":{"rendered":"Database Mirroring &#8211; Operation Mode High Safety Without Failover &#8211; Parte 1"},"content":{"rendered":"<p>Fala Pessoal,<\/p>\n<p>Nesse post come\u00e7o a testar como o Database Mirroring se comporta configurado com o Operation mode High Safety Without Automatic Failover.<\/p>\n<p>Inst\u00e2ncias participantes dos testes:<\/p>\n<p>1 &#8211; Instancia5\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211; Servidor Principal, referenciado no texto por Servidor A<br \/>\n2 &#8211; Instancia5\\INST1\u00a0\u00a0\u00a0 &#8211; Servidor Mirror, referenciado no texto por Servidor B<\/p>\n<p>Nome da database espelhada: Mirror1<\/p>\n<p>Script de cria\u00e7\u00e3o da tabela Teste:<\/p>\n<p>CREATE TABLE [dbo].[Teste](<br \/>\n[Cod] [int] IDENTITY(1,1) NOT NULL,<br \/>\n[Data] [datetime] NULL default(getdate()),<br \/>\n[Texto] [varchar](4000) NULL )<\/p>\n<p>Loop de teste:<\/p>\n<p>while 1=1<br \/>\nbegin<br \/>\nif exists (select null from sys.databases where name = &#8216;MIRROR1&#8217; and state_desc = &#8216;ONLINE&#8217;)<br \/>\ninsert into mirror1..Teste(texto)<br \/>\nselect @@servername<\/p>\n<p>waitfor delay &#8217;00:00:01&#8242;<br \/>\nend<\/p>\n<p><strong>Nesse teste foi simulado um Failover manual do Servidor A para o Servidor B.<\/strong><\/p>\n<p>Com o Mirror configurado como abaixo:<\/p>\n<p><a href=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1578\" title=\"Figura1\" src=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura1.png\" alt=\"\" width=\"502\" height=\"80\" srcset=\"https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura1.png 502w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura1-300x48.png 300w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura1-410x65.png 410w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura1-100x16.png 100w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura1-275x44.png 275w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura1-20x3.png 20w\" sizes=\"auto, (max-width: 502px) 100vw, 502px\" \/><\/a><\/p>\n<p>Deixei o loop rodando no servidor A e fiz um failover manual com o comando: <strong>alter database mirror1 set partner failover<\/strong><\/p>\n<p>Se voc\u00ea executar esse comando no Servidor B (Mirror) o erro abaixo \u00e9 gerado. Logo, o failover manual deve ser executado no servidor A (Principal).<\/p>\n<p><a href=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1579\" title=\"Figura2\" src=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura2.png\" alt=\"\" width=\"906\" height=\"54\" srcset=\"https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura2.png 906w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura2-300x18.png 300w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura2-768x46.png 768w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura2-700x42.png 700w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura2-410x24.png 410w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura2-100x6.png 100w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura2-275x16.png 275w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura2-20x1.png 20w\" sizes=\"auto, (max-width: 906px) 100vw, 906px\" \/><\/a><\/p>\n<p>Ao fazer o failover no principal, temos um warning de que algumas transa\u00e7\u00f5es sofreram rollback e o loop que estava sendo executado para de executar:<\/p>\n<p><a href=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1580\" title=\"Figura3\" src=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura3.png\" alt=\"\" width=\"608\" height=\"49\" srcset=\"https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura3.png 608w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura3-300x24.png 300w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura3-600x49.png 600w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura3-410x33.png 410w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura3-100x8.png 100w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura3-275x22.png 275w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura3-20x2.png 20w\" sizes=\"auto, (max-width: 608px) 100vw, 608px\" \/><\/a><\/p>\n<p>Em pouco tempo, o failover \u00e9 efetuado e o mirror fica como abaixo:<\/p>\n<p><a href=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1581\" title=\"Figura4\" src=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura4.png\" alt=\"\" width=\"499\" height=\"82\" srcset=\"https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura4.png 499w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura4-300x49.png 300w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura4-410x67.png 410w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura4-100x16.png 100w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura4-275x45.png 275w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/05\/Figura4-20x3.png 20w\" sizes=\"auto, (max-width: 499px) 100vw, 499px\" \/><\/a><\/p>\n<p>O servidor B assumiu o papel de principal e o servidor A de Mirror.<\/p>\n<p>Esse procedimento pode ser utilizado em instala\u00e7\u00f5es de Service Packs ou Migra\u00e7\u00f5es de Banco de Dados diminuindo o tempo de parada do SQL Server.<\/p>\n<p>Artigos relacionados:<\/p>\n<p><a href=\"https:\/\/www.fabriciolima.net\/blog\/2012\/05\/15\/serie-de-posts-sobre-database-mirroring\/\" target=\"_blank\">S\u00e9rie de Posts sobre Database Mirroring<\/a><\/p>\n<p><a href=\"https:\/\/www.fabriciolima.net\/blog\/2012\/05\/15\/database-mirroring-como-alterar-o-operation-mode\/\" target=\"_blank\">Database Mirroring \u2013 Como alterar o Operation Mode<\/a><\/p>\n<p><a href=\"https:\/\/www.fabriciolima.net\/blog\/2012\/05\/23\/database-mirroring-testes-operation-mode-high-performance-parte-1\/\" target=\"_blank\">Database Mirroring \u2013 Operation Mode High Performance \u2013 Parte 1<\/a><\/p>\n<p><a href=\"https:\/\/www.fabriciolima.net\/blog\/2012\/05\/28\/database-mirroring-operation-mode-high-performance-parte-2\/\" target=\"_blank\">Database Mirroring \u2013 Operation Mode High Performance \u2013 Parte 2<\/a><\/p>\n<p><a href=\"https:\/\/www.fabriciolima.net\/blog\/2012\/05\/31\/database-mirroring-operation-mode-high-performance-parte-3\/\" target=\"_blank\">Database Mirroring &#8211; Operation Mode High Performance &#8211; Parte 3<\/a><\/p>\n<p>At\u00e9 o pr\u00f3ximo teste com esse Operation Mode.<\/p>\n<p><b>Gostou desse Post?<\/b><\/p>\n<p>Cadastre seu e-mail para receber novos Posts e curta minha <a href=\"https:\/\/www.facebook.com\/FabricioLimaSolucoesemBancodeDados\/\" target=\"_blank\">P\u00e1gina no Facebook<\/a> para receber Dicas de Leituras e Eventos sobre SQL Server.<\/p>\n<p>Abra\u00e7os,<\/p>\n<p>Fabr\u00edcio Lima<\/p>\n<p>MCITP \u2013 Database Administrator<\/p>\n<p>Consultor e Instrutor SQL Server<\/p>\n<p>Trabalha com SQL Server desde 2006<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fala Pessoal, Nesse post come\u00e7o a testar como o Database Mirroring se comporta configurado com o Operation mode High Safety Without Automatic Failover. Inst\u00e2ncias participantes dos testes: 1 &#8211; Instancia5\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211; Servidor Principal, referenciado no texto por Servidor A 2 &#8211; Instancia5\\INST1\u00a0\u00a0\u00a0 &#8211; Servidor Mirror, referenciado no texto por Servidor B Nome da database espelhada: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[3,280],"tags":[604,606,391,23,607,372,613,611,612,610,608,616,49,33,50,34,605,609,614,615],"class_list":["post-1520","post","type-post","status-publish","format-standard","hentry","category-administracao-de-bd","category-virtual-pass-br","tag-alta-disponibilidade","tag-database-mirror","tag-database-mirroring","tag-dba","tag-espelhamento-de-banco-de-dados","tag-high-availability","tag-high-performance","tag-high-safety-with-automatic-failover","tag-high-safety-without-automatic-failover","tag-operation-mode","tag-perda-de-dados","tag-safety","tag-sql","tag-sql-server","tag-sql-server-2005","tag-sql-server-2008","tag-sql-server-mirror","tag-sql-server-online","tag-sys-database_mirroring","tag-witness"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/fabriciolima.net\/blog\/wp-json\/wp\/v2\/posts\/1520","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fabriciolima.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fabriciolima.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fabriciolima.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fabriciolima.net\/blog\/wp-json\/wp\/v2\/comments?post=1520"}],"version-history":[{"count":0,"href":"https:\/\/fabriciolima.net\/blog\/wp-json\/wp\/v2\/posts\/1520\/revisions"}],"wp:attachment":[{"href":"https:\/\/fabriciolima.net\/blog\/wp-json\/wp\/v2\/media?parent=1520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fabriciolima.net\/blog\/wp-json\/wp\/v2\/categories?post=1520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fabriciolima.net\/blog\/wp-json\/wp\/v2\/tags?post=1520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}