{"id":1399,"date":"2012-05-15T22:49:33","date_gmt":"2012-05-16T00:49:33","guid":{"rendered":"http:\/\/fabriciolima.net\/blog\/?p=1399"},"modified":"2016-07-24T10:20:18","modified_gmt":"2016-07-24T13:20:18","slug":"database-mirroring-como-alterar-o-operation-mode","status":"publish","type":"post","link":"https:\/\/fabriciolima.net\/blog\/2012\/05\/15\/database-mirroring-como-alterar-o-operation-mode\/","title":{"rendered":"Database Mirroring &#8211; Como alterar o Operation Mode"},"content":{"rendered":"<p>Fala Pessoal,<\/p>\n<p>Nesse primeiro teste, realizei todas as altera\u00e7\u00f5es de Operations Mode poss\u00edveis em um Database Mirroring.<\/p>\n<p>Os 3 operations mode poss\u00edveis s\u00e3o:<\/p>\n<ul>\n<li> High Safety with Automatic Failover.<\/li>\n<li>High Safety without Automatic Failover.<\/li>\n<li>High Performance.<\/li>\n<\/ul>\n<p>Para acompanhar as altera\u00e7\u00f5es, utilizei a query abaixo ap\u00f3s cada altera\u00e7\u00e3o de status do Mirror:<\/p>\n<p>SELECT db.name, mirroring_state_desc, mirroring_safety_level_desc,mirroring_witness_state_desc<\/p>\n<p>FROM sys.database_mirroring m<\/p>\n<p>JOIN sys.databases db ON db.database_id = m.database_id<\/p>\n<p>where name = &#8216;Mirror1&#8217; \u2013Nome da database espelhada<\/p>\n<p><strong>Teste 1: High Safety with Automatic Failover\u00a0 =&gt;\u00a0 High Safety without Automatic Failover<\/strong><\/p>\n<p>Para realizar essa altera\u00e7\u00e3o, o comando abaixo deve ser executado:<\/p>\n<p>USE [master]\n<p>GO<\/p>\n<p>ALTER DATABASE [Mirror1] SET WITNESS OFF<\/p>\n<p>Conferindo com a query de acompanhamento, temos o resultado:<\/p>\n<p style=\"margin: 0cm 0cm 0.0001pt;\"><span style=\"font-size: 11pt; font-family: &amp;amp;amp;\"><\/p>\n<p><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0.0001pt; text-align: center;\"><span style=\"font-size: 11pt; font-family: &amp;amp;amp;\"><a href=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura1.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1402\" title=\"Figura1\" src=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura1.png\" alt=\"\" width=\"508\" height=\"68\" srcset=\"https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura1.png 508w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura1-300x40.png 300w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura1-410x55.png 410w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura1-100x13.png 100w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura1-275x37.png 275w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura1-20x3.png 20w\" sizes=\"auto, (max-width: 508px) 100vw, 508px\" \/><\/a><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0.0001pt; text-align: left;\">\n<p><em>Safety_Level\u00a0 FULL + Witness_State UNKNOWN = High Safety without Automatic Failover<\/em><\/p>\n<p><strong>Volta: High Safety without Automatic Failover =&gt; High Safety with Automatic Failover<\/strong><\/p>\n<p>Para identificar o servidor de Witness, deve-se executar um IPCONFIG \/all e pegar as informa\u00e7\u00f5es de HostName e Primary DNS Suffix:<\/p>\n<ul>\n<li> Host Name: Ambiente5<\/li>\n<li> Primary DNS Suffix: lab.local<\/li>\n<li> Completando a string tempos a porta utilizada pelo Endpoint desse servidor: 5024<\/li>\n<\/ul>\n<p>Para adicionar um servidor de WITNESS em um Database Mirroring, o comando abaixo deve ser executado:<\/p>\n<p>USE [master]\n<p>GO<\/p>\n<p>ALTER DATABASE [Mirror1] SET WITNESS = N&#8217;TCP:\/\/Ambiente5.lab.local:5024&#8242;<\/p>\n<p>Resultado ap\u00f3s a altera\u00e7\u00e3o:<\/p>\n<p style=\"margin: 0cm 0cm 0.0001pt;\">\n<p style=\"margin: 0cm 0cm 0.0001pt; text-align: center;\"><span style=\"font-size: 11pt; font-family: &amp;amp;amp; color: black;\"><a href=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura2.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1403\" title=\"Figura2\" src=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura2.png\" alt=\"\" width=\"508\" height=\"63\" srcset=\"https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura2.png 508w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura2-300x37.png 300w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura2-410x51.png 410w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura2-100x12.png 100w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura2-275x34.png 275w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura2-20x2.png 20w\" sizes=\"auto, (max-width: 508px) 100vw, 508px\" \/><\/a><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0.0001pt; text-align: center;\">\n<p><em>Safety_Level\u00a0 FULL + Witness_State CONNECTED = High Safety without Automatic Failover<\/em><\/p>\n<p><span style=\"font-size: 11pt; font-family: &amp;amp;amp; color: black;\"> <\/span><strong>Teste 2: High Safety with Automatic Failover =&gt; High Performance<\/strong><\/p>\n<p>Para realizar essa altera\u00e7\u00e3o, os comandos abaixo devem ser executados:<\/p>\n<p>USE [master]\n<p>ALTER DATABASE [Mirror1] SET WITNESS OFF<\/p>\n<p>GO<\/p>\n<p>ALTER DATABASE [Mirror1] SET SAFETY OFF<\/p>\n<p>Resultado ap\u00f3s a altera\u00e7\u00e3o:<\/p>\n<p style=\"margin: 0cm 0cm 0.0001pt;\">\n<p style=\"margin: 0cm 0cm 0.0001pt; text-align: center;\"><span style=\"font-size: 11pt; font-family: &amp;amp;amp; color: black;\" lang=\"EN-US\"><a href=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura3.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1404\" title=\"Figura3\" src=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura3.png\" alt=\"\" width=\"511\" height=\"70\" srcset=\"https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura3.png 511w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura3-300x41.png 300w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura3-410x56.png 410w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura3-100x14.png 100w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura3-275x38.png 275w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura3-20x3.png 20w\" sizes=\"auto, (max-width: 511px) 100vw, 511px\" \/><\/a><\/span><\/p>\n<p><em>Safety_Level\u00a0 OFF + Witness_State UNKNOWN = High Performance<\/em><\/p>\n<p><strong>Volta: High Performance =&gt;High Safety with Automatic Failover<\/strong><\/p>\n<p>Para realizar essa altera\u00e7\u00e3o, os comandos abaixo devem ser executados:<\/p>\n<p>USE [master]\n<p>GO<\/p>\n<p>ALTER DATABASE [Mirror1] SET SAFETY FULL<\/p>\n<p>GO<\/p>\n<p>ALTER DATABASE [Mirror1] SET WITNESS = N&#8217;TCP:\/\/Ambiente5.lab.local:5024&#8242;<\/p>\n<p>GO<\/p>\n<p>Resultado ap\u00f3s a altera\u00e7\u00e3o:<\/p>\n<p style=\"margin: 0cm 0cm 0.0001pt;\">\n<p style=\"margin: 0cm 0cm 0.0001pt; text-align: center;\"><span style=\"font-size: 11pt; font-family: &amp;amp;amp; color: black;\"><a href=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura2.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1403\" title=\"Figura2\" src=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura2.png\" alt=\"\" width=\"508\" height=\"63\" srcset=\"https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura2.png 508w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura2-300x37.png 300w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura2-410x51.png 410w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura2-100x12.png 100w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura2-275x34.png 275w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura2-20x2.png 20w\" sizes=\"auto, (max-width: 508px) 100vw, 508px\" \/><\/a><\/span><\/p>\n<p><\n\n\n<p><em>Safety_Level\u00a0 FULL + Witness_State CONNECTED = High Safety with Automatic Failover<\/em><\/p>\n<p><strong>Teste 3 &#8211; High Safety without Automatic Failover =&gt; High Performance<\/strong><\/p>\n<p>Para realizar essa altera\u00e7\u00e3o, o comando abaixo deve ser executado:<\/p>\n<p>USE [master]\n<p>GO<\/p>\n<p>ALTER DATABASE [Mirror1] SET SAFETY OFF<\/p>\n<p>Resultado ap\u00f3s a altera\u00e7\u00e3o:<\/p>\n<p style=\"text-align: center;\"><span style=\"font-size: 11pt; font-family: &amp;amp;amp; color: black;\" lang=\"EN-US\"><a href=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura3.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1404\" title=\"Figura3\" src=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura3.png\" alt=\"\" width=\"511\" height=\"70\" srcset=\"https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura3.png 511w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura3-300x41.png 300w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura3-410x56.png 410w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura3-100x14.png 100w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura3-275x38.png 275w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura3-20x3.png 20w\" sizes=\"auto, (max-width: 511px) 100vw, 511px\" \/><\/a><\/span><\/p>\n<p><em>Safety_Level\u00a0 OFF + Witness_State UNKNOWN = High Performance<\/em><\/p>\n<p><strong>Volta: High Performance =&gt; High Safety without Automatic Failover<\/strong><\/p>\n<p>Para realizar essa altera\u00e7\u00e3o, o comando abaixo deve ser executado:<\/p>\n<p>USE [master]\n<p>GO<\/p>\n<p>ALTER DATABASE [Mirror1] SET SAFETY FULL<\/p>\n<p>Resultado ap\u00f3s a altera\u00e7\u00e3o:<\/p>\n<p style=\"margin: 0cm; margin-bottom: .0001pt;\"><span style=\"font-size: 11.0pt; font-family: &amp;amp;amp; color: black; mso-ansi-language: EN-US;\" lang=\"EN-US\"><\/p>\n<p><\/span><\/p>\n<p style=\"text-align: center;\"><span style=\"font-size: 11pt; font-family: &amp;amp;amp;\"><a href=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura1.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1402\" title=\"Figura1\" src=\"https:\/\/www.fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura1.png\" alt=\"\" width=\"508\" height=\"68\" srcset=\"https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura1.png 508w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura1-300x40.png 300w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura1-410x55.png 410w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura1-100x13.png 100w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura1-275x37.png 275w, https:\/\/fabriciolima.net\/blog\/wp-content\/uploads\/2012\/03\/Figura1-20x3.png 20w\" sizes=\"auto, (max-width: 508px) 100vw, 508px\" \/><\/a><\/span><\/p>\n<p><em>Safety_Level\u00a0 FULL + Witness_State UNKNOWN = High Safety without Automatic Failover<\/em><\/p>\n<p>Com esse Post j\u00e1 temos um resumo de como alternar entre os Operations Mode do Database Mirroring. Ap\u00f3s alguns testes, todas essas altera\u00e7\u00f5es j\u00e1 ficam na sua cabe\u00e7a.<\/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 primeiro teste, realizei todas as altera\u00e7\u00f5es de Operations Mode poss\u00edveis em um Database Mirroring. Os 3 operations mode poss\u00edveis s\u00e3o: High Safety with Automatic Failover. High Safety without Automatic Failover. High Performance. Para acompanhar as altera\u00e7\u00f5es, utilizei a query abaixo ap\u00f3s cada altera\u00e7\u00e3o de status do Mirror: SELECT db.name, mirroring_state_desc, mirroring_safety_level_desc,mirroring_witness_state_desc FROM [&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-1399","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\/1399","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=1399"}],"version-history":[{"count":0,"href":"https:\/\/fabriciolima.net\/blog\/wp-json\/wp\/v2\/posts\/1399\/revisions"}],"wp:attachment":[{"href":"https:\/\/fabriciolima.net\/blog\/wp-json\/wp\/v2\/media?parent=1399"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fabriciolima.net\/blog\/wp-json\/wp\/v2\/categories?post=1399"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fabriciolima.net\/blog\/wp-json\/wp\/v2\/tags?post=1399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}