How to fix Em client database issues:
I had an issue were Em client was not properly updating the gui so I closed it out. When I tried to restart it it would not start up. Searched about this and ran across this in the forums:
Download this and try: http://www.emclient.com/tools/DbRepai…
If the problem persist, you may need to delete the database and start fresh. Database location:
C:\Users%Current User%\AppData\Roaming\eM Client (Vista/Win7)
C:\Documents and Settings%Current User%\Application Data\eM Client (XP)
but the checker tool was getting these errors:
System.Data.SQLite.SQLiteException: The database file is locked
database is locked
at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
at System.Data.SQLite.SQLiteDataReader.NextResult()
at System.Data.SQLite.SQLiteDataReader…ctor(SQLiteCommand cmd, CommandBehavior behave)
at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()
at System.Data.SQLite.SQLiteConnection.Open()
at DbRepair.DbTools.OpenConnection(String fileName)
at DbRepair.Form1.CheckCorruption()
at DbRepair.Form1.Check(Object state)
The first thing is to determine if the process is still active. Task manager did not show it but I used another app called unlocker and found that there were still open handles on the files. I unlocked all the open handles and then tried to rerun the repair utility but still got this:
System.Data.SQLite.SQLiteException: Some kind of disk I/O error occurred
disk I/O error
at System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain)
at System.Data.SQLite.SQLiteCommand.BuildNextCommand()
at System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index)
at System.Data.SQLite.SQLiteDataReader.NextResult()
at System.Data.SQLite.SQLiteDataReader…ctor(SQLiteCommand cmd, CommandBehavior behave)
at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()
at System.Data.SQLite.SQLiteConnection.Open()
at DbRepair.DbTools.OpenConnection(String fileName)
at DbRepair.Form1.CheckCorruption()
at DbRepair.Form1.Check(Object state)
ok so not the same error but something to look at. I looked around for general info on what to do when an sqlite database is corrupt and how to deal with it and came across this link:
http://community.spiceworks.com/how_t…
not quite what I want but close so:
-
made a copy of my em client folder
-
downloaded the sqlite command line interface: http://www.sqlite.org/download.html
-
Started using it to open the dat files in the directory. I wanted to check the mail first to make sure it was ok
sqlite mail_data.dat
once in I typed:
PRAGMA integrity_check;
as long as it returns with “OK” we are good.
I then typed:
.quit
to exit out of the sqlite command line.
I started doing this for the other folders in the directory:
sqlite mail_fti.dat
sqlite mail_index.dat
and ran the above commands on each database
When I ran this on the privacylistings.dat I noticed there was also a privacylistings.dat-shm and privacylistings.dat-wall file after running the commands however the shm and wall files were no longer there.
This is good. I proceeded with:
atachments.dat
catagory_index.dat
certificate_index.dat
contact_data.dat
contact_index.dat
event_data.dat
even_index.dat
folders.dat
im_data.dat
security_index.dat
task_data.dat
task_index.dat
telemetry.dat
timezones.dat
I did not find one error in any of the databases.
-
I copied the files back to their original location.
-
fired up em client but it still did not start. Checked for open file handles but there were none. So I reran the db rebuild utility from above. This time it did not error out right away. It completed the check for inconsistencies and then for corrupt data and found none for either.
-
After all this em client still would not start so I used process explorer and found the emclient instance and killed it. It was called MailClient.exe and I made sure to select kill process tree.
-
Then restarted emclient and it found that it had not been shut down correctly and reran it’s check utility which passed again with no issues.
So to sum up.
- If you see these do kill the mailclient.exe process making sure to kill the process tree. If the files are still locked then reboot or use a tool like unlocker to unlock them.
- Use sqlite command line tool to verify all your db’s
- Run the dbrebuild tool provided by emclient in case there is data corruption
- Then restart em client.
If we would have needed to there are further steps to take in that we can dump the databases and reimport them. You may loose some small amount of data that way if tables are corrupt but should be able to recover most of it. I’m not sure but maybe the db rebuild tool from emclient would do this for you also.
have a good day all.