{"id":191,"date":"2012-06-13T19:49:37","date_gmt":"2012-06-13T19:49:37","guid":{"rendered":"http:\/\/www.sqlfreelancer.com\/blog\/?p=191"},"modified":"2014-03-05T20:00:26","modified_gmt":"2014-03-05T20:00:26","slug":"steps-to-apply-a-service-pack-or-patch-to-mirrored-sql-server-databases","status":"publish","type":"post","link":"https:\/\/www.sqlfreelancer.com\/blog\/steps-to-apply-a-service-pack-or-patch-to-mirrored-sql-server-databases\/","title":{"rendered":"Steps to Apply a Service Pack or Patch to Mirrored SQL Server Databases"},"content":{"rendered":"<p>In this post, I am going to outline my environment and then walk through the process of patching mirrored servers.<\/p>\n<p>My test environment consists of two SQL Server 2005 SP2 servers named SSQL1 (principal) and SSQL2 (mirror) that contain eleven mirrored databases. The database mirroring operating mode is set to asynchronous and I&#8217;m upgrading to SP4.<\/p>\n<p>Here is a look at the two mirrored instances.<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-192\" alt=\"SQL Freelancer SQL Server Mirroring Service Pack\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack.png\" width=\"454\" height=\"723\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack.png 454w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack-188x300.png 188w\" sizes=\"auto, (max-width: 454px) 100vw, 454px\" \/><\/a><\/p>\n<p>Step 1<br \/>\nAlways backup all system and user databases before applying patches.<\/p>\n<p>Step 2<br \/>\nRemote Desktop into the &#8220;Mirror&#8221; server (SSQL2 in our example) and download\/copy the patch to the server.<\/p>\n<p>Step 3<br \/>\nStop all SQL Services on the &#8220;Mirror&#8221; server.<\/p>\n<p>Step 4<br \/>\nRun the patch on the &#8220;Mirror&#8221; server.<\/p>\n<p>Step 5<br \/>\nOnce the patch is complete, reboot the &#8220;Mirror&#8221; server.<\/p>\n<p>Step 6 (optional)<br \/>\nIf your database mirroring is set to asynchronous (High Performance mode), we will need to synchronize the databases first. To do this we will need to issue the following statement for every database on the &#8220;Principal&#8221; server that is mirrored.<\/p>\n<div>\n<pre>ALTER DATABASE <em>databasename <\/em>SET SAFETY FULL<\/pre>\n<\/div>\n<p>Here are the commands for the 11 databases on my server.<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-193\" alt=\"SQL Freelancer SQL Server Mirroring Service Pack\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack-1.png\" width=\"472\" height=\"183\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack-1.png 472w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack-1-300x116.png 300w\" sizes=\"auto, (max-width: 472px) 100vw, 472px\" \/><\/a>Step 7<br \/>\nThe databases might change to &#8220;synchronizing&#8221; while the transactions catch up. Once all of the databases show &#8220;synchronized&#8221;, as shown below, we can perform the manual failover.<br \/>\n<a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-194\" alt=\"SQL Freelancer SQL Server Mirroring Service Pack\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack-2.png\" width=\"438\" height=\"300\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack-2.png 438w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack-2-300x205.png 300w\" sizes=\"auto, (max-width: 438px) 100vw, 438px\" \/><\/a><\/p>\n<p>We can perform the failover using the following statement on the principal server for each database:<\/p>\n<div>\n<pre>ALTER DATABASE <em>databasename <\/em>SET PARTNER FAILOVER<\/pre>\n<\/div>\n<p>Here are the commands for the 11 databases on my server.<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-195\" alt=\"SQL Freelancer SQL Server Mirroring Service Pack\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack-3.png\" width=\"491\" height=\"188\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack-3.png 491w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack-3-300x114.png 300w\" sizes=\"auto, (max-width: 491px) 100vw, 491px\" \/><\/a><br \/>\nWe can now see that the servers have switched roles.<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack-4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-196\" alt=\"SQL Freelancer SQL Server Mirroring Service Pack\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack-4.png\" width=\"458\" height=\"708\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack-4.png 458w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Database-Mirroring-Service-Pack-4-194x300.png 194w\" sizes=\"auto, (max-width: 458px) 100vw, 458px\" \/><\/a><br \/>\n<a href=\"http:\/\/www.mssqltips.com\/sqlservertip\/2701\/steps-to-apply-a-service-pack-or-patch-to-mirrored-sql-server-databases\/\" target=\"_blank\">Click here to view the rest of this post.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post, I am going to outline my environment and then walk through the process of patching mirrored servers. My test environment consists of two SQL Server 2005 SP2 servers named SSQL1 (principal) and SSQL2 (mirror) that contain eleven mirrored databases. The database mirroring operating mode is set to asynchronous and I&#8217;m upgrading to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,100],"tags":[7,23,44],"class_list":["post-191","post","type-post","status-publish","format-standard","hentry","category-database-mirroring","category-high-availability","tag-high-availability","tag-mirroring","tag-service-packs"],"_links":{"self":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/comments?post=191"}],"version-history":[{"count":3,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/191\/revisions"}],"predecessor-version":[{"id":199,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/191\/revisions\/199"}],"wp:attachment":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/media?parent=191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/categories?post=191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/tags?post=191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}