{"id":282,"date":"2013-12-02T04:12:53","date_gmt":"2013-12-02T04:12:53","guid":{"rendered":"http:\/\/www.itcrumbs.com\/?p=282"},"modified":"2019-02-07T04:39:45","modified_gmt":"2019-02-07T04:39:45","slug":"why-exchange-databases-might-remain-dirty-after-eseutil-r-recovery","status":"publish","type":"post","link":"http:\/\/www.itcrumbs.com\/?p=282","title":{"rendered":"Why Exchange Databases Might Remain Dirty After ESEUTIL \/R Recovery"},"content":{"rendered":"<p><a title=\"http:\/\/blogs.technet.com\/b\/mspfe\/archive\/2012\/09\/06\/why-exchange-databases-might-remain-dirty-after-eseutil-r-recovery.aspx\" href=\"http:\/\/blogs.technet.com\/b\/mspfe\/archive\/2012\/09\/06\/why-exchange-databases-might-remain-dirty-after-eseutil-r-recovery.aspx\">http:\/\/blogs.technet.com\/b\/mspfe\/archive\/2012\/09\/06\/why-exchange-databases-might-remain-dirty-after-eseutil-r-recovery.aspx<\/a><\/p>\n<p>&#160;<\/p>\n<p><em>You\u2019re trying to recover your Exchange database from the \u201cdirty shutdown\u201d state to \u201cclean shutdown.\u201d&#160; You use ESEUTIL \/R and after several ill-fated attempts the databases remain dirty.&#160; What\u2019s happening?&#160; <strong>Danijel Klaric. a Microsoft Premier Field Engineer based in Germany<\/strong>, sheds some light on why the Exchange 2007\/2010 databases might remain dirty after a seemingly \u201csuccessful\u201d ESEUTIL \/R recovery, and provides pointers on how to solve this.&#160; Enjoy his article!<\/em><\/p>\n<hr \/>\n<p>Normally I wouldn&#8217;t think that this following topic would ever be a problem, but as I faced the issue two times in the last three weeks, I thought it would be good to shine some light on the subject.<\/p>\n<p>Both customers are using <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/dd876874.aspx#FleMaiPro\">Exchange 2010 with Native Data Protection<\/a>, and have enabled a seven day lag on one of their database copies to enable their admins to recover items past the \u201csingle item recovery\u201d period, or to recover deleted folder structures. Remember that single item recovery doesn&#8217;t preserve the folder structure as mails moved to the dumpster are stored in a flat hierarchy.<\/p>\n<h4>The Symptom<\/h4>\n<p>They thought they were following appropriate Microsoft guidelines to use logs needed to recover the database from the \u201cdirty shutdown\u201d state to \u201cclean shutdown\u201d, so that the database would be usable as a recovery database for extracting the needed content.<\/p>\n<h5>1) Collect the database and the required logs<\/h5>\n<p>First grab a copy of the edb file and needed logs (i.e. logs needed from database perspective and logs they would like to roll forward to). This can be accomplished by suspending the database copy, and then copying the needed files to a separate location or create a snapshot of the volume which can be reverted to at a later time.<\/p>\n<h5>2) Check database state<\/h5>\n<p>Run the following:<strong><em> eseutil \/mh &quot;c:\\DBRecovery\\Mailbox Database 0436312751.edb&quot;<\/em><\/strong><\/p>\n<p><a href=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-92-37-metablogapi\/3463.image_5F00_2021F5E3.png\"><img loading=\"lazy\" decoding=\"async\" title=\"eseutil \/mh &quot;c:\\DBRecovery\\Mailbox Database 0436312751.edb&quot; \" border=\"0\" alt=\"eseutil \/mh &quot;c:\\DBRecovery\\Mailbox Database 0436312751.edb&quot; \" src=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-92-37-metablogapi\/5428.image_5F00_thumb_5F00_54561F29.png\" width=\"632\" height=\"389\" \/><\/a><\/p>\n<p>Check the database header for log files generation needed for the recovery, in this case: <strong><em>Log Required 124-124 (0x7c-0x7c) <\/em><\/strong>which means<em><strong> file E000000007C <\/strong>. <\/em>These log files are needed at a minimum to recover the database to a clean shutdown without data loss.<\/p>\n<p><b>Side note: <\/b>If you try to recover the database with only \u201cLog Required\u201d logs and NOT \u201cLog Commited\u201d logs it will throw the following error:<\/p>\n<p><a href=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-92-37-metablogapi\/0310.image_5F00_2F585EB0.png\"><img loading=\"lazy\" decoding=\"async\" title=\"Side note: If you try to recover the database with only \u201cLog Required logs\u201d and NOT \u201cLog Commited\u201d logs it will throw the error:\" border=\"0\" alt=\"Side note: If you try to recover the database with only \u201cLog Required logs\u201d and NOT \u201cLog Commited\u201d logs it will throw the error:\" src=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-92-37-metablogapi\/6014.image_5F00_thumb_5F00_6AABC46E.png\" width=\"631\" height=\"124\" \/><\/a><\/p>\n<p>You can continue with the recovery using <b>\/a<\/b>. And the last committed transaction will be removed from the database and the database will have a clean and consistent state. Otherwise just add the log files mentioned in the \u201c<i>log committed\u201d <\/i>field to your log directory and this error will disappear.<\/p>\n<h5>3) Check consistency of needed logs<\/h5>\n<p>Before starting to apply the logs you would like to, it\u00b4s important to check if all logs are consistent and available. If you need to handle a large number of logs and have used the Windows Explorer to copy the files, occasionally I\u2019ve seen that some files are missing when sorting them in the Windows Explorer view.<\/p>\n<p>To ensure that you will not fail afterwards when performing the recovery, take a moment and check these. Use <strong>eseutil \/ml<\/strong> together with your log directory path and log prefix, in my example E00.<\/p>\n<p>Log file check within directory: <b><i>eseutil \/ml c:\\DBRecovery\\E00<\/i><\/b><\/p>\n<p><a href=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-92-37-metablogapi\/4530.image_5F00_33D17028.png\"><img loading=\"lazy\" decoding=\"async\" title=\"Log file check within directory: eseutil \/ml c:\\DBRecovery\\E00\" border=\"0\" alt=\"Log file check within directory: eseutil \/ml c:\\DBRecovery\\E00\" src=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-92-37-metablogapi\/4848.image_5F00_thumb_5F00_5A335373.png\" width=\"614\" height=\"230\" \/><\/a><\/p>\n<h5>4) Recover database state to \u201cclean shutdown\u201d<\/h5>\n<p>After they finished both checks successfully, they started the recovery using:<\/p>\n<p><b><i>eseutil \/R E00 \/l &quot;c:\\DBRecovery&quot; \/d &quot;c:\\DBRecovery\\Mailbox Database 0436312751.edb&quot;<\/i><\/b><b> <\/b>    <br \/><a href=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-92-37-metablogapi\/6518.image_5F00_0E677CBA.png\"><img loading=\"lazy\" decoding=\"async\" title=\"eseutil \/R E00 \/l &quot;c:\\DBRecovery&quot; \/d &quot;c:\\DBRecovery\\Mailbox Database 0436312751.edb&quot;  \" border=\"0\" alt=\"eseutil \/R E00 \/l &quot;c:\\DBRecovery&quot; \/d &quot;c:\\DBRecovery\\Mailbox Database 0436312751.edb&quot;  \" src=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-92-37-metablogapi\/8640.image_5F00_thumb_5F00_655F6E6E.png\" width=\"608\" height=\"679\" \/><\/a><\/p>\n<p>It failed with an Error \u201c-1216\u201d. They did some Internet research and found that this could be fixed by using the <b><i>\u201c\/i&quot;<\/i><\/b><\/p>\n<p>So their next try was:<\/p>\n<p><b><i>eseutil \/R E00 \/l c:\\DBRecovery \/d &quot;c:\\DBRecovery\\Mailbox Database 0436312751.edb&quot; \/i<\/i><\/b><b><i> <\/i><\/b><\/p>\n<p><a href=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-92-37-metablogapi\/7587.image_5F00_002B947B.png\"><img loading=\"lazy\" decoding=\"async\" title=\"eseutil \/R E00 \/l c:\\DBRecovery \/d &quot;c:\\DBRecovery\\Mailbox Database 0436312751.edb&quot; \/i \" border=\"0\" alt=\"eseutil \/R E00 \/l c:\\DBRecovery \/d &quot;c:\\DBRecovery\\Mailbox Database 0436312751.edb&quot; \/i \" src=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-92-37-metablogapi\/2311.image_5F00_thumb_5F00_696C4CF1.png\" width=\"630\" height=\"207\" \/><\/a><\/p>\n<p>And <b>YES<\/b> it results in <i>\u201cOperation completed successfully in 0.140 seconds.\u201d<\/i> Then they checked the Application event log and <b>YES,<\/b> there is no Error.<\/p>\n<p><a href=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-92-37-metablogapi\/1321.image_5F00_4B8DC8F0.png\"><img loading=\"lazy\" decoding=\"async\" title=\"Application event log \" border=\"0\" alt=\"Application event log \" src=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-92-37-metablogapi\/3884.image_5F00_thumb_5F00_120AB8F9.png\" width=\"634\" height=\"127\" \/><\/a><\/p>\n<p>Their last check before mounting the database was <b><i>eseutil \/mh &quot;c:\\DBRecovery\\Mailbox Database 0436312751.edb.&quot;&#160; <\/i><\/b>After all that work &#8211; STILL a \u201cdirty shutdown\u201d <img decoding=\"async\" alt=\"Sad smile\" src=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-92-37-metablogapi\/5025.wlEmoticon_2D00_sadsmile_5F00_6659EEFC.png\" \/>.<\/p>\n<p><b>Note:<\/b><\/p>\n<p>The get quick access to their data, they executed the <b><i>eseutil<\/i> <\/b>command using <b><i>\/P<\/i><\/b> for a repair to get the database into a clean shutdown. Microsoft strongly discourages using <b><i>eseutil \/P<\/i><\/b> because it may lead to data loss. The <strong>\/P<\/strong> should be a measure of extreme desperation when there\u2019s no way at all to recover your database via <strong>\/R<\/strong>.<\/p>\n<h4>Troubleshooting Steps \u2013 How did we solve it?<\/h4>\n<p>They showed me their eseutil command:<\/p>\n<p><b><i>eseutil \/R E00 \/l &quot;c:\\DBRecovery&quot; \/d &quot;c:\\DBRecovery\\Mailbox Database 0436312751.edb\u201d \/i<\/i><\/b><i><\/i><\/p>\n<p>I saw three things I wouldn&#8217;t expect to see:<\/p>\n<ol>\n<li><b><i>\u201c\/i\u201d<\/i><\/b> is a parameter for skipping missing log stream attached databases. In older versions of Exchange one log stream was used per storage group. As a storage group could have contained multiple databases, the \u201c\/i\u201d option was provided when only one out of multiple databases has to be recovered.&#160;&#160; As Exchange 2010 doesn\u2019t use storage groups any more, this parameter shouldn\u2019t be used any more. <\/li>\n<li><b><i>\u201c\/d\u201d<\/i><\/b> parameter with the fully qualified path to the EDB file.&#160; You HAVE to use the directory path and NOT the full path to the edb file. <\/li>\n<li>They also didn\u2019t specify a system path, so the actual path of the cmd prompt is used. This directory is used to check for, or to create, an E0x.chk file. I always recommend specifying the same path as the edb and log directory to keep the files together, and ensure that the files you expect to be used are the ones which are always used.<\/li>\n<\/ol>\n<p>First, I asked them to remove the <b>\u201c\/i\u201d<\/b> parameter and to try it again, they told me that this resulted in the previously mentioned error:&#160; \u201c-1216 (JET_errAttachedDatabaseMismatch)\u201d.<\/p>\n<p>Checking the EventLog after removing the <b>\u201c\/i\u201d<\/b> parameter, it stated that the database file has not been found at path <i>\u201cC:\\DBRecovery\\Mailbox Database 0436312751.edb\\Mailbox Database <\/i><i>0436312751.edb&quot; <\/i>which makes sense.<\/p>\n<p><a href=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-92-37-metablogapi\/8168.image_5F00_01FE7AF3.png\"><img loading=\"lazy\" decoding=\"async\" title=\"Checking the EventLog\" border=\"0\" alt=\"Checking the EventLog\" src=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-92-37-metablogapi\/8255.image_5F00_thumb_5F00_214121C6.png\" width=\"657\" height=\"418\" \/><\/a><\/p>\n<p>After removing the file name and ending \u201c\\\u201d, and optionally adding the system directory parameter to the command, we ran <strong>eseutil<\/strong><i><strong> \/R E00 \/l \u201cc:\\DBRecovery\u201d<\/strong> <b>\/s \u201cc:\\DBRecovery\u201d \/d \u201cc:\\DBRecovery\u201d.&#160; <\/b><\/i>Running this modified command, everything worked as expected and the database ended up in a \u201cclean shutdown\u201d without any error message.<\/p>\n<p><a href=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-92-37-metablogapi\/8664.image_5F00_65F04CB8.png\"><img loading=\"lazy\" decoding=\"async\" title=\"eseutil \/R E00 \/l \u201cc:\\DBRecovery\u201d \/s \u201cc:\\DBRecovery\u201d \/d \u201cc:\\DBRecovery\u201d.\" border=\"0\" alt=\"eseutil \/R E00 \/l \u201cc:\\DBRecovery\u201d \/s \u201cc:\\DBRecovery\u201d \/d \u201cc:\\DBRecovery\u201d.\" src=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-92-37-metablogapi\/5444.image_5F00_thumb_5F00_1A2475FF.png\" width=\"657\" height=\"390\" \/><\/a><\/p>\n<p><b>Note:<\/b> If the database still stays in \u201cdirty shutdown\u201d, check the specified system directory for an <strong>e0x.chk<\/strong> file from your previous attempts. This checkpoint file can be safely removed for this recovery process if only logs that are needed for your recovery exist in the log directory. Following that, the command should complete successfully.<\/p>\n<h4>So why was this happening?<\/h4>\n<p>I was wondering why two different customers would make the \u201csame\u201d mistake using <b><i>eseutil \/r,<\/i><\/b> so I started some Internet research and found sites providing examples using <b><i>\u201ceseutil \/r \/d\u201d<\/i><\/b> with the full path to the edb. This will simply not work.&#160; Most of these mention that sometimes this will not work \u2013 and recommend using <b><i>\/p<\/i><\/b> to perform a repair of the database. As mentioned, this shouldn\u2019t be the recommended way as long as the edb file and the required logs exist and are available to be used.<\/p>\n<p>Another possible misunderstanding would be that <b><i>eseutil<\/i><\/b> also incorporates another \u201cMODES OF OPERATION\u201d which use <b><i>\u201c\/d\u201d<\/i><\/b> as a parameter \u2013&gt; Database defrag. So if you use <b><i>\u201ceseutil \/d\u201d<\/i><\/b> to defrag a database you have to specify a complete file path.<\/p>\n<p>Hope this helps. And after reading through this, just sit back and use the ESEUtil parameter which you should try out with your Exchange 2007\/2010 server (without any risk):&#160; <b><i>\u201ceseutil \/ESE.\u201d&#160; <\/i><\/b>And give them their credits providing such a solid database <img decoding=\"async\" alt=\"Smile\" src=\"http:\/\/blogs.technet.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-92-37-metablogapi\/2313.wlEmoticon_2D00_smile_5F00_2314083E.png\" \/>.<\/p>\n<p>Thanks goes to Alexandre Costa and James Cameron reviewing this content.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>http:\/\/blogs.technet.com\/b\/mspfe\/archive\/2012\/09\/06\/why-exchange-databases-might-remain-dirty-after-eseutil-r-recovery.aspx &#160; You\u2019re trying to recover your Exchange database from the \u201cdirty shutdown\u201d state to \u201cclean shutdown.\u201d&#160; You use ESEUTIL \/R and after several ill-fated attempts the databases remain dirty.&#160; What\u2019s happening?&#160; Danijel Klaric. a Microsoft Premier Field Engineer based in Germany, sheds some light on why the Exchange 2007\/2010 databases might remain dirty after [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-282","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.itcrumbs.com\/index.php?rest_route=\/wp\/v2\/posts\/282","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.itcrumbs.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.itcrumbs.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.itcrumbs.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/www.itcrumbs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=282"}],"version-history":[{"count":1,"href":"http:\/\/www.itcrumbs.com\/index.php?rest_route=\/wp\/v2\/posts\/282\/revisions"}],"predecessor-version":[{"id":685,"href":"http:\/\/www.itcrumbs.com\/index.php?rest_route=\/wp\/v2\/posts\/282\/revisions\/685"}],"wp:attachment":[{"href":"http:\/\/www.itcrumbs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=282"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.itcrumbs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=282"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.itcrumbs.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}