Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

[OT] How to fix the BerkeleyDB 52G data ?

by Perl_Love (Acolyte)
on Sep 19, 2016 at 15:11 UTC ( #1172148=perlquestion: print w/replies, xml ) Need Help??

Perl_Love has asked for the wisdom of the Perl Monks concerning the following question:

I am running Perl script on CentOS7, BerkeleyDB data is generated continuously, because of a sudden power failure, the database is damaged, I can not read any data, there are 52G data.

I try to fix it, but did not succeed, __db.001 , __db.002 , __db.003 have been removed in the repair process, please help me, what is the method to get the data?

Thank you!

Below this is the way to produce data:

...... sub DB{ $env=new BerkeleyDB::Env -Home=>$db_home, -Flags=>DB_CREATE|DB_INIT_MPOOL || die; $db=tie(%hash,"BerkeleyDB::Btree", -Filename=>$db_name, -Flags=>DB_CREATE, -Env=>$env) || die; } ......

The following is a reading method, but is no work

$|=1; use BerkeleyDB; my $env=new BerkeleyDB::Env -Home=>'/home/root/URL/DB' #-Flags=>DB_CREATE#|DB_INIT_MPOOL || die; my %hash; my $db=tie(%hash,"BerkeleyDB::Btree", -Filename=>'URL.db', # -Flags=>DB_CREATE, -Env=>$env) || die; while(my ($k,$v)=each %hash){ print "$k\t$v\n"; } untie $db;

Replies are listed 'Best First'.
Re: [OT] How to fix the BerkeleyDB 52G data ?
by davido (Cardinal) on Sep 19, 2016 at 15:25 UTC
Re: [OT] How to fix the BerkeleyDB 52G data ?
by stevieb (Canon) on Sep 19, 2016 at 15:27 UTC

    This doesn't appear to be a Perl issue, but a DB issue.

    After a quick Google, I found db_recover. If that, or other Berkeley DB recovery techniques don't work, you may have to restore the DB from a backup.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1172148]
Approved by davido
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2021-01-22 00:41 GMT
Find Nodes?
    Voting Booth?