Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Moving DB_Files

by katzuma (Acolyte)
on Nov 26, 2002 at 22:00 UTC ( [id://215948]=perlquestion: print w/replies, xml ) Need Help??

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?

Replies are listed 'Best First'.
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.
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.
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.

      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.
Re: Moving DB_Files
by krisahoch (Deacon) on Nov 27, 2002 at 16:07 UTC

    Dude(tte)

    Try this,

    1. Zip the files up
    2. Ftp transfer as binary
    3. 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

      why using proprietary code for compressing? use tar (take look man tar) for free os dude(tte;)

        I would have said that, but tar is hard to come by on Schmindows (windows)


        Kristofer Hoch

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://215948]
Approved by petral
Front-paged by jarich
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-23 06:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found