Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: farmer_boy on November 28, 2010, 10:59:38 PM



Title: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: farmer_boy on November 28, 2010, 10:59:38 PM
I get the following scary message in my log:

************************
EXCEPTION: 22DbRunRecoveryException       
DbEnv::open: DB_RUNRECOVERY: Fatal error, run database recovery       
bitcoin in AppInit()


I already tried db4.7_dump <the only file existing in the .bitconf/database directory, but I got a format error there.

Solution?



Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: theymos on November 28, 2010, 11:05:25 PM
Try deleting your blkindex.dat and blk*.dat files.


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: farmer_boy on November 28, 2010, 11:19:33 PM
Try deleting your blkindex.dat and blk*.dat files.
I mv'ed the file under database and afterwards everything also seemed to be fine (as in the wallet still exists). What is the actual consequence of me moving that file? Or what is stored in that file?

I can move it back if needed, of course. It is 9.6MB.


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: theymos on November 28, 2010, 11:32:24 PM
What is the actual consequence of me moving that file? Or what is stored in that file?

It contains journaling information for the block database files (blkindex.dat and blk*.dat).

It's possible that deleting that could damage the block database. I recommend deleting the other block database files, too.


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: bitcoinex on November 30, 2010, 03:39:22 AM
FIRST - BACKUP!111


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: imanikin on December 31, 2010, 10:04:59 PM
Is it known what causes this error? Is it possible that it would happen when mine and another machine finish calculating the same block at the same time and deadlock the db somehow?

(I guess, it's just coincidence, but so far, the only time i got this error, which corrupted my db, was exactly on the day that bitcoin calculator predicted that i would calculate another block. I mean almost to the hour...) ???

After deleting the suggested files, B started working again...


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: theymos on January 01, 2011, 12:27:42 AM
(I guess, it's just coincidence, but so far, the only time i got this error, which corrupted my db, was exactly on the day that bitcoin calculator predicted that i would calculate another block. I mean almost to the hour...) ???

It must be a coincidence, since that calculation is purely an estimate. It would be very rare for it to be accurate to an hour.


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: imanikin on January 01, 2011, 03:02:30 AM
It must be a coincidence, since that calculation is purely an estimate. It would be very rare for it to be accurate to an hour.

Thank you for your time and help. So, it's not known yet what causes this error, and how to prevent it?

What are the other block database files you mentioned, which i should delete, even though Bitcoin seems to be working for now?


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: theymos on January 01, 2011, 04:18:23 AM
So, it's not known yet what causes this error, and how to prevent it?

It's probably caused by the normal causes of file corruption: antivirus software, a failing disk, shutting down your computer improperly, etc.

Quote
What are the other block database files you mentioned, which i should delete, even though Bitcoin seems to be working for now?

Don't delete anything if it's working.

The first thing you should try for all Bitcoin database problems is deleting everything in the data directory except wallet.dat, debug.log, and bitcoin.conf (if it exists). All of the other files can be safely regenerated. (Debug.log is not necessary, but it might be helpful to have it later.)

If this problem happens repeatedly, and you're not getting errors in other programs, it could be a bug in Bitcoin. Post details in that case.


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: jago25_98 on March 27, 2011, 11:56:12 PM
I have the same problem. I can only get bitcoin to run if I delete the ~/.bitcoin/database directory but if I do that my balance is zero!

I can't see how my wallet.dat backup can help me...?


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: randomproof on April 01, 2011, 04:55:36 PM
I get the following scary message in my log:

************************
EXCEPTION: 22DbRunRecoveryException       
DbEnv::open: DB_RUNRECOVERY: Fatal error, run database recovery       
bitcoin in AppInit()


I already tried db4.7_dump <the only file existing in the .bitconf/database directory, but I got a format error there.

Solution?



Let me guess, you are running the version of bitcoin that came in the office debian repo?  That version is build with db_4.8 where are the version from the www.bitcoin.org is build with db_4.7.  The database formats are not compatible.  Just delete all the files in the data folder execpt for wallet.dat and it should run, but your client will have to download the whole block chain again.


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: jago25_98 on April 01, 2011, 07:31:29 PM
My output is:

Code:
j@rv:~/.bitcoin$ bitcoin server starting


************************
EXCEPTION: 22DbRunRecoveryException
DbEnv::open: DB_RUNRECOVERY: Fatal error, run database recovery
bitcoin in AppInit()

terminate called after throwing an instance of 'DbRunRecoveryException'
  what():  DbEnv::open: DB_RUNRECOVERY: Fatal error, run database recovery

Code:
j@rv:~/.bitcoin$ ls -R
.:
addr.dat  bitcoin.conf  bk  blk0001.dat  blkindex.dat  database  db.log  debug.log  wallet.dat

./bk:
database  __db.001  __db.002  __db.003  __db.004  __db.005  __db.006

./bk/database:
log.0000000001

./database:
log.0000000044
j@rv:~/.bitcoin$

The only way I can get the daemon to start is by removing ./database/log.0000000044 but then my balance becomes zero.

It's probably because the server didn't shutdown properly. But wallet.dat is backed up and ok. There's a few thousand bitcoins at stake here... need support...


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: theymos on April 02, 2011, 05:31:42 AM
Try moving all files and directories except wallet.dat somewhere else. Then allow Bitcoin to re-download the blocks.


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: jago25_98 on April 11, 2011, 10:20:08 PM
Thanks for the suggestion... but it results in a zero balance (!)


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: theymos on April 12, 2011, 11:53:30 AM
Thanks for the suggestion... but it results in a zero balance (!)

Wait for Bitcoin to download the blocks again.


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: fetokun on May 05, 2011, 09:45:08 AM
Thanks for the suggestion... but it results in a zero balance (!)

I had the same problem.
just removed (after a backup of course) the file "log.0000000004" inside the database folder and it was OK.

kept my balance alright


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: joulesbeef on July 21, 2011, 10:18:19 PM
help!

I just got that error today... tried deleting everything but wallet.dat and still get the same error.

reinstalled bitcoin.. started it up.. just fine.. copied over wallet.dat and same error. So is my wallet screwed?


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: ama on September 02, 2011, 11:45:42 PM
help!

I just got that error today... tried deleting everything but wallet.dat and still get the same error.

reinstalled bitcoin.. started it up.. just fine.. copied over wallet.dat and same error. So is my wallet screwed?

Any solution for that?  I'm having the same problem.


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: ArtForz on September 03, 2011, 01:49:10 PM
If you still get that error after deleting everything but wallet.dat (that includes the /database/log.* files)... yeah, you're probably screwed.
Last resort, iirc in the dev section someone posted code to pull anything that looks like a privkey out of a corrupt wallet.dat, then you can 'simply' inject them into a fresh wallet on a bitcoin with the privkey import/export patch and finally do a -rescan.


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: jackjack on September 05, 2011, 07:03:20 PM
As kojko proposed in another thread, you can send your wallet to someone savvy you trust
I can try if you want, I am currently developing pywallet so I know what I can try


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: RaTTuS on September 06, 2011, 11:21:58 AM
1) JackJack knows what he's talking about
2) stop the client
- make sure the client is stopped and there are no bitcoin processes running
3) backup the .bitcoin directory
4) delete these
blk0001.dat 
blkindex.dat
db.log 
debug.log
__db.001
__db.002
__db.003
__db.004
__db.005
__db.006
5) restart the client with a rescan i.e.
bitcoin -rescan
6) wait until all blocks are downloaded [if you have blk0001.dat and blkindex.dat on another machine this can speed the issue up]


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: haydent on December 12, 2011, 10:34:15 AM
after upgrading to latest version and restarting a few times i got this error mentioned. reinstalling (without uninstall) worked but only till i restarted the client the next time.

then thought id try deleting the file in database folder, this worked too, and lasts client restarts

also using an older version pre qt worked too, infact i have them both in the saem install as i didnt uninstall pre-qt version b4 installing qt version.

there's something about seeing the confirm numbers ticking over as your block chain updates that i miss from the old client.... ;(


Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: zveda2000 on December 14, 2011, 06:53:03 AM
OK I just had this happen to me:

1. Power in house went out causing PC to switch off.
2. When power came back on and I restarted, the bitcoin database was corrupted and caused the machine to completely freeze on the "Loading Addresses" splash screen, since I set my bitcoin-qt to run as PC boots up. I tried restarting about 5-10 times til I realised it was bitcoin-qt that was doing it. It made the machine completely unusable. Couldn't even kill any processes. The log file was saying something about "PANIC" and to do database recovery. Very annoying. I know a corrupted bitcoin database is bad but I don't see why it should break the whole machine. Even ctrl-alt-backspace wouldn't work anymore.

So I deleted all the database files and now bitcoin-qt opens fine and starts syncing. However, if while it is syncing I go into options, don't change anything, and click OK, that causes it to immediately crash for some reason. 

I am running version 0.5.0.1 BTW with Linux Mint 11.

Hope it helps.



Title: Re: Database error: DB_RUNRECOVERY: Fatal error, run database recovery
Post by: haydent on December 14, 2011, 06:54:49 AM
i spoke too soon, i still get these crashes een with old version though maybe not as much, but deleting the database folder still works for me atleast temporarily.