60 lines
2.8 KiB
Plaintext
60 lines
2.8 KiB
Plaintext
If you are getting weird but serious-sounding errors like 'database image is malformed', your database may be corrupt!
|
|
|
|
Nine times out of ten, corrupted databases happen because of hardware failure, usually the hard drive writing bad sectors. This is a serious problem.
|
|
|
|
|
|
first, shut everything down
|
|
|
|
Close the client immediately.
|
|
|
|
If you are on Windows, open task manager (Ctrl+Shift+Esc) and wait for client.exe to disappear from the list. If it takes more than a couple of minutes, forcibly close it with task manager.
|
|
|
|
|
|
check integrity
|
|
|
|
Then check your hard drive's integrity.
|
|
|
|
On Windows, go Start->Run (Win+R) and type 'cmd'. Type chkdsk into the new window and wait for it to scan your drive.
|
|
|
|
If you find problems, then your drive has been compromised in some way, and you should view it as unreliable. If it is an old drive, you should think about buying a replacement. The exception to 'buy a new drive' is if the existing one is new, works well, and you can trace the error to a specific event, like you had an unprotected power surge during a storm that violently reset your computer. The other exception is if you cannot afford it. :/
|
|
|
|
On Windows, tell chkdsk to fix the problems it found by running it again with the /F modifier, like 'chkdsk /F'.
|
|
|
|
If your hard drive is fine, please send me the details! If it could be my code breaking things, I want to know asap!
|
|
|
|
|
|
now what?
|
|
|
|
If you have a recent backup of your client, it is probably a good idea just to restore from that. A lot of hard drive errors cannot be recovered from. Just copy your backup client.db on top of your corrupted client.db and you are good to go.
|
|
|
|
If you do not have a backup, you'll have to try recovering what data you can from the corrupted db.
|
|
|
|
First of all, make a _new_ backup of the corrupted db, just in case something goes wrong with the recovery and we need to try again. You can just copy the client.db, but having a copy of all your files is a great idea if you have the time and space.
|
|
|
|
FreeFileSync is great for maintaining regular backups. It only takes a few minutes a week to stay safe.
|
|
|
|
|
|
fix the problem
|
|
|
|
Open the SQLite shell, which should be in the db directory, called sqlite3 or sqlite3.exe. Type:
|
|
|
|
.open client.db
|
|
PRAGMA integrity_check;
|
|
|
|
The integrity check doesn't correct anything, but it lets you know the magnitude of the problem: if only a couple of issues are found, you may be in luck.
|
|
|
|
If it doesn't look too bad, then go:
|
|
|
|
.clone client_new.db
|
|
|
|
And wait a bit. It'll report its progress as it tries to copy your db's info to a new, cleaner db.
|
|
|
|
.exit
|
|
|
|
Will close the shell.
|
|
|
|
If the clone doesn't work, contact me and I'll help you manually extract what you can to a new db.
|
|
|
|
If the clone does work, rename client.db to client_old.db and client_new.db to client.db. Then, try running the client!
|
|
|
|
If you still get problems, please contact me. Check help/contact.html for ways to do that. |