{"id":517,"date":"2009-04-27T20:47:27","date_gmt":"2009-04-27T20:47:27","guid":{"rendered":"https:\/\/www.wapshere.com\/missmiis\/?p=517"},"modified":"2009-11-06T18:53:22","modified_gmt":"2009-11-06T18:53:22","slug":"exchange-2007-failover-and-failback-with-scr","status":"publish","type":"post","link":"https:\/\/www.wapshere.com\/missmiis\/exchange-2007-failover-and-failback-with-scr","title":{"rendered":"Exchange 2007 Failover and Failback with SCR"},"content":{"rendered":"<p>I&#8217;ve been doing a bit of work with SCR lately, the point being to achieve a &#8220;poor man&#8217;s failover&#8221; for the mailbox server role. Not everyone needs the immediacy, or the expense, of a cluster, and SCR was a welcome addition to the redundacy capabilities of Exchange 2007 &#8211; but I couldn&#8217;t find a complete step-by-step resource for failover and failback so, after having worked it all out myself, here it all is. <!--more--><\/p>\n<h2>What SCR is, and isn&#8217;t<\/h2>\n<p>I am not going to rehash the <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/bb676571.aspx\">SCR documentation<\/a> &#8211; but I will add some observations of my own.<\/p>\n<ul>\n<li>SCR is <em>not <\/em>a cluster.<\/li>\n<li>SCR is a way of copying the mail databases to another server where they can be activated without too much fuss &#8211; though there is nothing instantaneous about it because it is <em>not<\/em> a cluster.<\/li>\n<li>SCR failover can be achieved through database portability or through setup \/m:Recover.\n<ul>\n<li>The setup option actually rebuilds your standby server as the primary so it is not a good choice if you expect the primary to be back in business at some point.<\/li>\n<li>Database portability is a better choice for most failover scenarios.<\/li>\n<\/ul>\n<\/li>\n<li>Database portabilty should really be compared to restoring mail databases from backup rather than clustering (because remember, it&#8217;s <em>not<\/em> a cluster) &#8211; where it compares very favorably because:\n<ul>\n<li>it&#8217;s a lot faster as the data is already there on the standby server, and doesn&#8217;t need to be restored off tape, and<\/li>\n<li>it&#8217;s a heck of a lot more up-to-date than a tape backup is likely to be.<\/li>\n<\/ul>\n<\/li>\n<li>And finally &#8211; the failback takes a lot longer than the failover.<\/li>\n<\/ul>\n<h2>Preparing the Servers<\/h2>\n<p>Again all the information about setting up SCR is on technet <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/bb676465.aspx\">here<\/a> so I&#8217;m just going to add some description about the storage group config, which had not been immediately obvious to me. Let&#8217;s say you have storage group SG1 containing mailbox database MBX1 on SRV1. You want SRV2 to be able to mount the database in case of corruption on SRV1, or all out failure of SRV1. The logs and data locations are as follows:<\/p>\n<table border=\"0\">\n<tbody>\n<tr>\n<td>SG1 Logs<\/td>\n<td>E:\\Logs\\SG1<\/td>\n<\/tr>\n<tr>\n<td>SG1 System<\/td>\n<td>E:\\Logs\\SG1<\/td>\n<\/tr>\n<tr>\n<td>MBX1 Data<\/td>\n<td>F:\\Data\\SG1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The first thing you have to do is create the exact same folders in the exact same paths on the target server &#8211; but just leave them empty.<\/p>\n<p>The next thing you do, and this is not an immediately obvious step, is to create a placeholder storage group and mail database on SRV2. If the time comes to failover you will actually mount the database copy in this placeholder DB &#8211; but you can&#8217;t give it the same name as the original. Got that?<\/p>\n<p>Following the example naming from <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/bb738132.aspx\">technet<\/a>, create storage group SG1PORT and mail database MBX1PORT on SRV2. Mount the db, just to check it works, and then dismount again.<\/p>\n<h2>Failover Steps<\/h2>\n<p>The time has come to move MBX1 to the standby server. These steps should be easily achievable in half an hour. It is assumed SRV1 is down, or at least the MBX1 database is not mounted on SRV1. <strong><\/strong><\/p>\n<p><strong>1. Prepare storage group for restore operation<\/strong><\/p>\n<p>Open the Exchange Management Shell on SRV2 and run the following commands.<\/p>\n<p><code>Restore-StorageGroupCopy SRV1SG1 -StandbyMachine SRV2<\/code><\/p>\n<p>Use the\u00c2\u00a0<code>\"-force\"<\/code> switch if the source server is down.<\/p>\n<p><strong>2. Repair database copy<\/strong><\/p>\n<p>Test current state of database copy. Look for &#8220;Clean Shutdown&#8221; or &#8220;Dirty Shutdown&#8221;.<\/p>\n<p><code>eseutil \/mh \"F:DataSG1MBX1.edb\"<\/code><\/p>\n<p>Repair database if in &#8220;Dirty Shutdown&#8221; state. Replace n with the number on the log files in the Log folder.<\/p>\n<p><code>eseutil \/r E0<em>n<\/em><\/code><\/p>\n<p>Confirm &#8220;Clean Shutdown&#8221; state:<\/p>\n<p><code>eseutil \/mh \"F:DataSG1MBX1.edb\"<\/code> <strong><\/strong><\/p>\n<p><strong>3. Move the folder locations of SG1PORT so they point to the SCR copied locations<\/strong><\/p>\n<p><code>Move-StorageGroupPath SRV2SG1PORT -SystemFolderPath \"E:LogsSG1\" -LogFolderPath \"E:LogsSG1\" -ConfigurationOnly Move-DatabasePath SRV2SG1PORTMBX1PORT -EdbFilePath \"F:DataSG1MBX1.edb\" -ConfigurationOnly<\/code> <strong><\/strong><\/p>\n<p><strong>4. Set the databases to over-writable and Mount them<\/strong><\/p>\n<p><code>Set-MailboxDatabase SRV2SG1PORTMBX1PORT -AllowFileRestore:$true Mount-Database SRV2SG1PORTMBX1PORT<\/code> <strong><\/strong><\/p>\n<p><strong>5. Change user homeMDB values to the new database locations<\/strong><\/p>\n<p><code>Get-Mailbox -Database SRV1SG1MBX1 |where {$_.ObjectClass -NotMatch '(SystemAttendantMailbox|ExOleDbSystemMailbox)'}| Move-Mailbox -ConfigurationOnly -TargetDatabase SRV2SG1PORTMBX1PORT<\/code><\/p>\n<p>Your users should now be able to re-access their mailboxes.<\/p>\n<h2>Failing Back<\/h2>\n<p>Now you have SRV1 back up and running and you want to move the mailbox database back. Unfortunately this is going to involve copying the entire EDB file <em>while the mailbox database is dismounted<\/em>. If the file is large, this could take a while.<\/p>\n<p>Your alternative is to make SRV2 the new primary &#8211; but keep in mind that you will have to reconfigure SCR to work in the opposite direction.<\/p>\n<p>If a <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/bb738131.aspx\">manual reseed<\/a> is required you&#8217;ll end up having to copy the EDB file anyway, so you won&#8217;t have saved yourself any downtime. The method for failing back is a straight forward <a href=\"http:\/\/www.msexchange.org\/tutorials\/Moving-Exchange-Server-2007-database-Mailbox-servers.html\">database move<\/a>.<\/p>\n<p><strong>1. Dismount the mail databases<\/strong><\/p>\n<p>Open the Exchange Management Shell on SRV2 and run the following commands.<\/p>\n<p><code>Dismount-Database -Identity SRV1SG1MBX1 Dismount-Database -Identity SRV2SG1PORTMBX1PORT<\/code> <strong><\/strong><\/p>\n<p><strong>2. Delete all logs from SRV1<\/strong><\/p>\n<p><code>Remove-Item -path \"\\SRV1E$LogsSG1*\" -Recurse<\/code> <strong><\/strong><\/p>\n<p><strong>3. Set the mail database on SRV1 to over-writable<\/strong><\/p>\n<p><code>Set-MailboxDatabase SRV1SG1MBX1 -AllowFileRestore:$true<\/code> <strong><\/strong><\/p>\n<p><strong>4. Copy the EDB file from SRV2 to SRV1<\/strong><\/p>\n<p><code>Copy-Item -Path \\SRV2F$DataSG1MBX1.edb -Destination \\SRV1F$DataSG1MBX1.edb<\/code> <strong><\/strong><\/p>\n<p><strong>5. Mount the mail database on SRV1<\/strong><\/p>\n<p><code>Mount-Database -Identity SRV1SG1MBX1<\/code> <strong><\/strong><\/p>\n<p><strong>6. Change user homeMDB attributes back to SRV1<\/strong><\/p>\n<p><code>Get-Mailbox -Database SRV2SG1PORTMBX1PORT |where {$_.ObjectClass -NotMatch '(SystemAttendantMailbox|ExOleDbSystemMailbox)'}| Move-Mailbox -ConfigurationOnly -TargetDatabase SRV1SG1MBX1<\/code><\/p>\n<p>The mail service is now restored, but you still need to get SCR working again. <strong><\/strong><\/p>\n<p><strong>7. Change SG1PORT back to original folders<\/strong><\/p>\n<p><code>Move-StorageGroupPath srv-exch2SG1PORT -SystemFolderPath \"E:LogsSG1PORT\" -LogFolderPath \"E:LogsSG1PORT\" -ConfigurationOnly Move-DatabasePath srv-exch2SG1PORTMBX1PORT -EdbFilePath \"F:DataSG1PORTMBX1PORT.edb\" -ConfigurationOnly<\/code> <strong><\/strong><\/p>\n<p><strong>8. Clear out SG1 folders on SRV2<\/strong><\/p>\n<p><code>Remove-Item -Path \"E:LogsSG1*\" -Recurse Remove-Item -Path \"F:DataSG1MBX1.edb\"<\/code><\/p>\n<p>You should now be able to re-enable the SCR replication from SRV1 to SRV2.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been doing a bit of work with SCR lately, the point being to achieve a &#8220;poor man&#8217;s failover&#8221; for the mailbox server role. Not everyone needs the immediacy, or the expense, of a cluster, and SCR was a welcome addition to the redundacy capabilities of Exchange 2007 &#8211; but I couldn&#8217;t find a complete&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[26],"tags":[],"class_list":["post-517","post","type-post","status-publish","format-standard","hentry","category-exchange2007"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pkp1o-8l","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/517","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/comments?post=517"}],"version-history":[{"count":13,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/517\/revisions"}],"predecessor-version":[{"id":524,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/517\/revisions\/524"}],"wp:attachment":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/media?parent=517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/categories?post=517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/tags?post=517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}