katzuma has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
What is the right format to back-up some $DB_HASH files ?
If i try binary when i upload them again DB_File dies with a 'wrong format'...
the same happens if i try TEXT format...
is it like a hybrid?
Re: Moving DB_Files
by iburrell (Chaplain) on Nov 26, 2002 at 23:33 UTC
|
They are binary files and should be transferred as such with FTP. Transferring them as text will corrupt them. How are you transferring the files? Berkeley DB files have holes; some naive programs won't handle files with holes. No FTP transfer process can restore the holes but that shouldn't corrupt the files, just make them use more space on disk.
| [reply] |
Re: Moving DB_Files
by hakkr (Chaplain) on Nov 27, 2002 at 10:15 UTC
|
Try viewing them you will see lots of garbage. The garbage is binary. When backing up you should always do some compression by zipping up the files. This may also provide the benfit of not corrupting your files in transit. Like the others said ensure you are in binary not ascii mode when transfering files by ftp. | [reply] |
Re: Moving DB_Files
by jreades (Friar) on Nov 26, 2002 at 22:59 UTC
|
If you've tied() your hash to a Berkeley DB file there are probably *two* files -- I forget the extensions, but they should be recongizably them same.
| [reply] |
|
You are thinking of NDBM/ODBM. It uses two files named .dir and .pag. Berkeley DB uses only one file usually with the extension .db.
| [reply] |
Re: Moving DB_Files
by krisahoch (Deacon) on Nov 27, 2002 at 16:07 UTC
|
Dude(tte)
Try this,
- Zip the files up
- Ftp transfer as binary
- Unzip the files
P.S. Make sure you zip and unzip with the "Windows to Windows or Linux", "Linux to Linux or Windows" or "Solaris to Solaris". Otherwise you may get crc errors while unzipping.
Kristofer Hoch
| [reply] |
|
why using proprietary code for compressing? use tar (take look man tar) for free os dude(tte;)
| [reply] |
|
| [reply] |
|