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