Link to home
Start Free TrialLog in
Avatar of danhartke
danhartkeFlag for United States of America

asked on

Can't Mount Database

I had a hardrive failure and recovered from a back-up and now exchange does not work and this is the error i get when i try to mount it


Failed to mount database 'Mailbox Database'.  Mailbox Database Failed Error: Exchange is \First Storage Group\Mailbox Database; Error code: MapiExceptionJetErrorAttachedDatabaseMismatch: Unable to mount database. (hr=0x80004005, ec=-1216) .
Avatar of pritamsh
pritamsh
Flag of India image

Follow this steps;

Run eseutil  /Mh  and eseutil /ML gainst database and logs respectively.
Check for database shutdown state.
If it is clean shutdown than copy all log files to different location and try to mount database
If it is in dirty shutdown check for which log file is missing and try to replace log files form backup
else run eseutil /r (soft recovery) for repairing corrupt database.

Before doing above mentioned steps i'll recommend uncheck option 'Start database at startup' and restart server then try to mount database.

Let me know it this helps.
Avatar of danhartke

ASKER

Forgive me, my exchange skills are seriously weak.
I am in a bit over my head

Where am I running those commands from?
Exchange Shell?


Assuming exchange 2003?

Then these commands can be found in c:\program files\exchsrvr\bin

open a command prompt and navigate to that directory
cmd
#> c:
#> cd c:\program files\exchsrvr\bin
#> eseutil /mh c:\program files\exchsrvr\MDBDATA\priv1.edb

Look at the output and see if the database is in "Clean Shutdown" or "Dirty shutdown"
(I am guessing dirty and there is something wrong with the logs or log file missing, but you might get lucky)

Generally in these cases it is better to recover from abckup and replay the log files (assuming that circular logging is not turned on.

Exchange recovery can be a long process, but if you can give us as much info about the backups you do have and your current setup we will do our best to assist you through the recovery.

Andy
I am running Exchange Server 2007 on Small Business Server 2008
What backup are you running?
Microsoft Server Back-up for Server 2008
As per above (@pritamsh) we should still find out if the DB is in a clean or dirty shutdown.

same process...
eseutil is in: C:\Program Files\Microsoft\Exchange Server\Bin
path to mailbox is probably C:\Program Files\Microsoft\Exchange Server\Mailbox\First Storage Group\

If database is in clean shutdown then
- remove logs
- mark database as "able to be over written by restore (scroll down: http://www.ibackup.com/online-backup-exchange-server/ibwin_new_ex_restore.htm)
- mount database

If in dirty shutdown let us know
I have mentioned that opiton as well ;)
PS. don;t delete log file - just move them somewhere else - we might need them again
@pritamsh - yes, you will notice I gave you credit for it. I just expanded on your suggestion :)
Thank you Aoakeley..
I am getting this error when I put the command in

C:\Program Files\Microsoft\Exchange Server\Bin>eseutil /mh D:\Exchange\Mail Data
base\Mailbox Database.edb

Usage Error: Invalid argument 'Database\Mailbox'. Options must be preceded by '-
' or '/'.
put the D:\Exchange\Mail Database\Mailbox Database.edb in """"

eseutil /mh "D:\Exchange\Mail Database\Mailbox Database.edb"
Returns

Initiating FILE DUMP mode...
Error: Access to source database 'D:\Exchange\Mail Database\Mailbox Database.edb
' failed with Jet error -1811.

Operation terminated with error -1811 (JET_errFileNotFound, File not found) afte
r 0.0 seconds.
So is D:\Exchange\Mail Database\Mailbox Database.edb really there?
Any typo?

Please confirm the file exists?
Initiating FILE DUMP mode...
         Database: D:\Exchange\Mail Database\Mailbox Database.edb

        File Type: Database
   Format ulMagic: 0x89abcdef
   Engine ulMagic: 0x89abcdef
 Format ulVersion: 0x620,12
 Engine ulVersion: 0x620,12
Created ulVersion: 0x620,12
     DB Signature: Create time:05/02/2011 02:02:23 Rand:5915623 Computer:
         cbDbPage: 8192
           dbtime: 279440470 (0x10a7ec56)
            State: Dirty Shutdown
     Log Required: 0-0 (0x0-0x0)
    Log Committed: 0-0 (0x0-0x0)
   Streaming File: No
         Shadowed: Yes
       Last Objid: 80591
     Scrub Dbtime: 0 (0x0)
       Scrub Date: 00/00/1900 00:00:00
     Repair Count: 2
      Repair Date: 05/02/2011 02:02:23
 Old Repair Count: 0
  Last Consistent: (0x0,0,0)  00/00/1900 00:00:00
      Last Attach: (0x0,0,0)  05/02/2011 02:02:23
      Last Detach: (0x0,0,0)  00/00/1900 00:00:00
             Dbid: 1
    Log Signature: Create time:00/00/1900 00:00:00 Rand:0 Computer:
       OS Version: (6.0.6001 SP 1 NLS 500100.50100)

Previous Full Backup:
        Log Gen: 0-0 (0x0-0x0)
           Mark: (0x0,0,0)
           Mark: 00/00/1900 00:00:00

Previous Incremental Backup:
        Log Gen: 0-0 (0x0-0x0)
           Mark: (0x0,0,0)
           Mark: 00/00/1900 00:00:00

Previous Copy Backup:
        Log Gen: 0-0 (0x0-0x0)
           Mark: (0x0,0,0)
           Mark: 00/00/1900 00:00:00

Previous Differential Backup:
        Log Gen: 0-0 (0x0-0x0)
           Mark: (0x0,0,0)
           Mark: 00/00/1900 00:00:00

Current Full Backup:
        Log Gen: 0-0 (0x0-0x0)
           Mark: (0x0,0,0)
           Mark: 00/00/1900 00:00:00

Current Shadow copy backup:
        Log Gen: 0-0 (0x0-0x0)
           Mark: (0x0,0,0)
           Mark: 00/00/1900 00:00:00

     cpgUpgrade55Format: 0
    cpgUpgradeFreePages: 0
cpgUpgradeSpaceMapPages: 0

       ECC Fix Success Count: none
   Old ECC Fix Success Count: none
         ECC Fix Error Count: none
     Old ECC Fix Error Count: none
    Bad Checksum Error Count: none
Old bad Checksum Error Count: none

Operation completed successfully in 0.234 seconds.
OK your database is in
State: Dirty Shutdown

Before you proceed further please confirm for me if you have "Circular Logging" enabled. This will be critical in determining how to go forward from here. See http://technet.microsoft.com/en-us/library/bb331968%28EXCHG.80%29.aspx for how to tell. Do not change anything - just let us know.

You could try running eseutil with the /r switch (as @pritamsh) suggested. But this is for soft recovery and will most likely not work anyway. Exchange performs a soft recovery when you try to mount the database.

You could try to *move* all log files and mount the dirty shutdown database (very slight chance it will mount)

the best solution is probably
1. Mark the databases as "able to be overwritten by a restore" using the Exchange Management Console
2. leave all the log files where they are and run an Exchange Restore from the windows backup utility
3. It will restore the database from the last backup and replay the log files.

Worst case scenario we can fix the database with eseutil /p - but that can damage the database.

Let us know about circular logging and we will proceed from there.

Andy




Circular logging is not enabled
I am waiting for the server to reboot after changing the drive letter assignment
When I restored the drive it changed the drive letter, hence the command not working

OK it is good that circular logging is not enabled.

Which drive letter changed?
- for the exchange databases to mount the drive letters need to be EXACTLY as there were before the server was recoverd.
- If the exchange database/log file drive letter was changed and you have no corrected that the databases may just mount now.
- Please confirm that you have/have not changed any database or log file paths in Exchange Management Console or Exchange Powershell since the server was recovered?


I changed the drive letter back to what it was before restore.

If you have not changed/deleted any log files, or changed the exchange configuration in any way, you may find that the database simply mounts now. X fingers.
Microsoft Exchange Error
--------------------------------------------------------
Failed to mount database 'Mailbox Database'.

Mailbox Database
Failed
Error:
Exchange is unable to mount the database that you specified. Specified database: NUTTINGSERVER\First Storage Group\Mailbox Database; Error code: MapiExceptionJetErrorAttachedDatabaseMismatch: Unable to mount database. (hr=0x80004005, ec=-1216)
.




--------------------------------------------------------
OK
--------------------------------------------------------
I see no option to do an exchange recover in the back-up utility
Before you do a restore, just try marking the database as "this database can be overwritten by a restore" and mounting it again.
no luck with that
See screenshot.

If you have setup the Windows sbs2008 backup you shold be able to restore exchange as per screenshots User generated image
I only see sharepoint services, not exchange there
Damn... you are in a world of hurt then.

So I can have some more insight into the failure and give you the next best way forward
1. When did the disk fail? (exact date and time please)
2. When was the backup? (exact date and time please)
3. Do you still have access to the old disk? is anything on it readable?

thanks

Andy
The disk failed saturday afternoon
I just restored it this morning to a functional back-up from Friday at noon

The disk that failed was the data disk, not the operating system.

Data on the drive is spotty, but somewhat readable
Are the reansaction logs and the database files in the same folder?
Is this D:\Exchange\Mail Database\
 - or what is the new drive letter?
just composing some commands for you... what do the log files start with? will be E00 or E01 etc
no the logs are not in the same directory

Log Path C:\Program Files\Microsoft\Exchange Server\Mailbox\First Storage Group

Database Path: D:\Exchange\Mail Database\Mailbox Database.edb
Log Files start with E0000021FBB, E0000021FBA
this is good if you have the transaction logs and the database and circular logging is off we should be able to replay the transaction logs.
the only issue is that your database does not know what log it should be replaying.
            State: Dirty Shutdown
     Log Required: 0-0 (0x0-0x0)
infact it thinks it is up-to-date

Try this from an elevated (run as administrator) command prompt. Assume everything is from an elevated prompt from here on in.


#> path=%path%;C:\Program Files\Microsoft\Exchange Server\Bin
#> d:
#> cd "D:\Exchange\Mail Database\"
#> eseutil /R E00 /I /D /L"C:\Program Files\Microsoft\Exchange Server\Mailbox\First Storage Group" /Sd:
Here is some info on eseutil /R so you can interpret the commands yourself
http://technet.microsoft.com/en-us/library/bb123479%28EXCHG.80%29.aspx 
any news?
Performing Soft Recovery Curently from the last set of instructions

I restored what I know to be a good directory first (Before I started tweaking things around)

Seems to be running though
Excellent. Generally soft recovery will fail right away if it is not going to work. So if it is running that is an excellent sign. Make sure that if this works you also assign points to @pritamsh.

You could technically assign all points to him. His first post was technically correct. I just tent to ask more questions to ensure my answers are as well targeted as possible.
It is working, but very slow
Database was about 60gigs
I hope I can award some points after this one and Exchange works again :)
We are more concerned about your Exchange server than gaining points, right Aoakeley :)
5gb per hour is the processing speed of eseutil. Because you are just replaying the logs it will not have to process all 60GB but can still take a while

@pritamsh - I go through phases. Mostly it is for my own amusement. Today I looked for the potentially most complex case in my field and jumped on it, (Exchange recovery is always fun). Some other days I try to pick off easy points. sometimes I go for weeks without doing an EE. but it is ALWAYS satisfying seeing someones problem solved.

Lets hope we are not jumping the gun and this actually fixes it :)
Initiating RECOVERY mode...
    Logfile base name: E00
            Log files: C:\Program Files\Microsoft\Exchange Server\Mailbox\First
Storage Group
         System files: d:
   Database Directory: <current directory>

Performing soft recovery...
                      Restore Status (% complete)

          0    10   20   30   40   50   60   70   80   90  100
          |----|----|----|----|----|----|----|----|----|----|
          ........



Operation terminated with error -515 (JET_errInvalidLogSequence, Timestamp in ne
xt log does not match expected) after 1512.984 seconds.
Danhartke,

are you ok with performing hard recovery? Hard recovery will involve loss of email.

Switch to run hard recovery : eseutil/ P
How much loss of email are we talking about?
Totally depends upon corruption may vary from 1 MB to complete database..

Just run eseutil /ML and eseutil /K and it will tell you how much logs are missing.
Potentially every email in the database could lose their attachments if the attachment table is deleted by eseutil /p

I would like to see if we can avoid eseutil /p if we can. Zero loss restore should be possible.

Did you run eseutil with all the switches I specified?
Yes I pasted it into Command Prompt
do what @pritamsh says with /ML and /K (you should be able to figure out the syntax yourself by now) and post results while I have a quick think.

C:\Program Files\Microsoft\Exchange Server\Bin>eseutil /ML "C:\Program Files\Mic
rosoft\Exchange Server\Mailbox\First Storage Group"

Extensible Storage Engine Utilities for Microsoft(R) Exchange Server
Version 08.02
Copyright (C) Microsoft Corporation. All Rights Reserved.

Initiating FILE DUMP mode...

      Base name: Fir
      Log file: C:\Program Files\Microsoft\Exchange Server\Mailbox\First Storage
 Group
                ERROR: Cannot open log file (C:\Program Files\Microsoft\Exchange
 Server\Mailbox\First Storage Group). Error -1032.

Operation terminated with error -1032 (JET_errFileAccessDenied, Cannot access fi
le, the file is locked or in use) after 10.31 seconds.
We can give this one a crack... (personally I have not had opportunity to use this on a live system yet, you you might have to tweak the syntax. Not sure if the /I is still applicable )

1. If the is an e00.chk in D: created by running the last command - delete it
2. #> ESEUTIL /R Enn /A /D /L"C:\Program Files\Microsoft\Exchange Server\Mailbox\First Storage Group" /Sd:

Recovering a database that has missing log files

In Exchange Server 2007, a new feature named Lost Log Resilience (LLR) protects Exchange databases from losing the last few log files, and enables faster recovery. When an LLR-protected log file is missing or corrupted, typical database mounting or recovery by using Eseutil fails and does not provide the new /A recovery option. Event ID 523 is logged to the Event log and states the kind of failure that occurred. On a database on which an LLR-protected log file is missing or corrupted, you can run Eseutil recovery by using the /A option in recovery mode as follows:

ESEUTIL /R Enn /A
with the /ML specify the full path to the EDB file - same as the /MH we ran earlier
@pritamsh - ever use eseutil /A ?
nope..what exactly it does?
Sorry - meant eseutil /R /E00 /A as per my earlier post?
use...last time i faced similar issue...i used this command eseutil /R /Enn /A /8
@pritamsh - Thanks for pointing out the /8 as ex2007 has 8K page size (used to be 4K)

From the eseutil /ML output
cbDbPage: 8192

Though I believe when running eseutil on the exchange server the databases come from we do not need to specify the page size.....

Lets see what the Author comes back with, we have given him quite a fw things to do now :) ...
OK Guys,

I am going to have to hit the sack (getting late here) so danhartke I will leave you with these points

1. use eseutil /p only as a last resort this is a destructive repair and you may not notice the database damage until days or week later, by which time it will not be possible to recover from.  Best case scenario after this restore you will be back to the time the backup was taken, no transaction log replay occurs. You will need to delete all the log files aftere eseutil /p for the database to mount.

2. use eseutil /MH before you mount the database to check if it is in a "clean Shutdown" state. A database in a  clean shutdown state can be mounted without any transaction logs. So if you get the DB into this state delete all the transaction logs and the database will mount

3. Tick the "this database can be over written by a restore" before mounting the database after any of these commands

4. use eseutil /K E00 to check the consistency of all the log files. If there is a berak in the log files it is most likely right at the end.

5. eseutil /R E00 /A should be able to assist you with missing log files. You can also use this trick to close out a log file sequence http://social.technet.microsoft.com/Forums/en-US/exchangesvrgeneral/thread/cc4f08f8-f422-4914-bb92-dc81966297b0/

6. Don't rush you should be able to get a 0 loss restore or very close to it. See the info here http://technet.microsoft.com/en-us/library/aa998249%28EXCHG.80%29.aspx for more detailed info on eseutil. note each command description has a "brief summary" and a detailed "how to run" section.

7. When this is all done and dusted make sure you have an "Exchange Aware" backup, or fix the windows backup (which is actually very good) so it recognises Exchange as an application.

8. did I mention don't rush

9. @pritamsh will be able to help you

10. you can also "request Attention" to get assistance from other experts. I have sent an email to a friend of mine who will also take a look in here

Good luck

Andy
It sems to be stotpping in the same place on each one

D:\Exchange\Mail Database>ESEUTIL /R E00 /A /D /L"C:\Program Files\Microsoft\Exc
hange Server\Mailbox\First Storage Group" /Sd:

Extensible Storage Engine Utilities for Microsoft(R) Exchange Server
Version 08.02
Copyright (C) Microsoft Corporation. All Rights Reserved.

Initiating RECOVERY mode...
    Logfile base name: E00
            Log files: C:\Program Files\Microsoft\Exchange Server\Mailbox\First
Storage Group
         System files: d:
   Database Directory: <current directory>

Performing soft recovery...
                      Restore Status (% complete)

          0    10   20   30   40   50   60   70   80   90  100
          |----|----|----|----|----|----|----|----|----|----|
          ........



Operation terminated with error -515 (JET_errInvalidLogSequence, Timestamp in ne
xt log does not match expected) after 816.937 seconds.
Can we get the output from /K and /MH please?

1.
#> cd C:\Program Files\Microsoft\Exchange Server\Mailbox\First Storage Group
#> eseutil /K E00

2.
#> eseutil /MH "D:\Exchange\Mail Database\Mailbox Database.edb"
sorrt meant ML
#> eseutil /ML "D:\Exchange\Mail Database\Mailbox Database.edb"
eseutil /K E00 is running with tons and tons of files. so far everything saying OK
Been running for about 10minutes
How many log files have you got? and how far back do they go?
50,729 ot March of last year
ASKER CERTIFIED SOLUTION
Avatar of Andrew Oakeley
Andrew Oakeley
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hey andy. Sorry i got to this a little late. Looks like you fixed the issue. Great Job.