dbTalk Databases Forums  

BDB file copy

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss BDB file copy in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
sandhya
 
Posts: n/a

Default BDB file copy - 12-26-2006 , 07:08 AM






Hi,

I have a requirement where an existing bdb file has to be copied to
another dir, something similar to

cp path1/bdbfile path2/bkup_bdbfile2

does BDB support any api where a copy of entirebdbfile can be done.

thanx

sandhya


Reply With Quote
  #2  
Old   
Philip Guenther
 
Posts: n/a

Default Re: BDB file copy - 01-01-2007 , 11:35 PM






On Dec 26 2006, 6:08 am, "sandhya" <bsan... (AT) gmail (DOT) com> wrote:
Quote:
I have a requirement where an existing bdb file has to be copied to
another dir, something similar to

cp path1/bdbfile path2/bkup_bdbfile2

does BDB support any api where a copy of entirebdbfile can be done.
Not directly. You can do it at the shell level by piping the output of
db_dump into db_load. In a program, you can do the same yourself by
creating the destination table with DB->open() and then copy the all
the items over by walking the source table with a cursor. If there are
multiple tables in the file then you have to iterate of those too.
It's not too complicated. Both those methods work regardless of
whether the tables are the in the same database environment or not and
whether or not transactions or CDB are in use. There may be more
efficient ways to copy the tables depending on those details, but then
it becomes dependent on your setup and may be broken by future
changes...


Philip Guenther



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.