database check failed - eM Client doesn't start anymore

Hello together,

I’m running within a virtual machine. Everything worked fine for over years. But now I head some issues with the VM. Now eM Client doesn’t get over the database check.

the protocol:

System.Data.SQLite.SQLiteException (0x80004005): database disk image is malformed
database disk image is malformed
   bei System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain)
   bei System.Data.SQLite.SQLiteCommand.BuildNextCommand()
   bei System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index)
   bei System.Data.SQLite.SQLiteDataReader.NextResult()
   bei System.Data.SQLite.SQLiteDataReader…ctor(SQLiteCommand cmd, CommandBehavior behave)
   bei System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
   bei System.Data.SQLite.SQLiteCommand.ExecuteNonQuery(CommandBehavior behavior)
   bei System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()
   bei System.Data.SQLite.SQLiteConnection.Open()
   bei MailClient.Storage.Data.DataStore.GetConnectionInternal(String relativeName)
   bei DbRepair.CorruptionChecker.CheckCorruption(RepairOptions repairOptions, CancellationToken token)
   bei DbRepair.CheckingProcess.Check(CancellationToken token)
Data:
SQLiteCommandText: PRAGMA synchronous=Normal
databaseFile: 49ea7643-26ef-470d-8024-7718b86d9499\contact_index.dat

I’m no expert with sql databases - but it seems to me that there is corrupt data. Is there any option to repair it? Or am I totally wrong with my  guess?

Thanks and all the best!

You can run the database repair application manually. C:\Program Files (x86)\eM Client\ DbRepair.exe.

But if that does not help, the usual method is to delete the database, and start again. Before deleting the the whole database, delete C:\Users_username_\AppData\Roaming\eM Client\49ea7643-26ef-470d-8024-7718b86d9499\contact_index.dat and see if that helps. After restarting eM Client, the contacts should resync with the server.

This didn’t work :frowning:
Is there any possibility to force eM client to rebuild the whole database?

Not beyond what the DbRepair.exe can do.

Looks like you need to delete the database, which is the whole  C:\Users_username_\AppData\Roaming\eM Client\ folder. After that you can restore from your last backup or setup everything as new.

I’ll try that. The problem is, that I had a lot of Mails in my local folders. Is there a possibility to restore them? I think the mail_data.dat belongs to them. This file might be okay.

Local data is all stored in the directory Local Folders within the database directory.

So, rename your database directory (so you have a safe copy), then start eM Client and close it again. This will create a new database directory. Copy the  Local Folders directory from the old database directory to the new one, and restart eM Client. 

I had no other choice than reinstall EM-Client in a new virtual machine. The old “broken” machine seems to be lost - now I use the last working backup as a “data graveyard” with the hope I never need to restore data from it.

The database of the local folders seems to be broken and can’t be restored that easy.

Nontheless, thanks for your help! Even if this was not the solution I was looking for.

All the best!

I had a similar problem.
I clicked on the folder (in your case) “49ea7643-26ef-470d-8024-7718b86d9499” to display the versions with right click, Properties, Previous version, then I moved the folder “49ea7643-26ef-470d-8024-7718b86d9499” to C:\Temp (backup) and then restored the previous version of the folder.
Then the DbRepair ran successfully and eM Client started again. The missing mails were reloaded from the mail server.

1 Like

That is a risky move and I would normally suggest you make a copy of the complete C:\Users\yourusername\AppData\Roaming\eM Client\ folder before doing that, because the files and folders within the database are not normally individually interchangeable with older versions.

But it is good that you achieved a positive result. :smile:

For those Windows users on version 8 of eM Client, the dbrepair can be run manually using the following command (including the " ") “C:\Program Files (x86)\eM Client\MailClient.exe” /dbrepair

This is changed since my previous comment above.

2 Likes