4 Replies Latest reply: Aug 26, 2014 6:23 PM by user4374420 RSS

    Does db_hotbackup work under Linux 3.0?

    user4374420

      Does anyone know how to build BDB such that db_hotbackup works under Linux?  I always get

       

         db_hotbackup: BDB5129 Cannot copy data from a PRIVATE environment

         db_hotbackup: BDB5043 HOT BACKUP FAILED!

       

      I'm using SUSE Linux 3.0.82-0.7-default, and get the same messages under RedHat 2.6.32-431.17.1.el6.x86_64.  It actually did work under a free EC2 instance running Amazon Linux 3.10.42-52.145.amzn1.x86_64, but I'd love to make it work under SUSE.

       

      None of the configuration advice in "Chapter 7. Building Berkeley DB for UNIX/POSIX" has worked for me.

       

      [ This is a follow-on to my question of July 13, 2014: "Linux, want DB_PRIVATE off". ]

        • 1. Re: Does db_hotbackup work under Linux 3.0?
          userBDBDMS-Oracle

          We can take a look at this but it would be easiest if you give us a reproducible test case.   Please provide the code used to create the database, load a small amount of dummy data into the database and how you are calling db_hotbackup.   

           

          thanks

          mike

          • 2. Re: Does db_hotbackup work under Linux 3.0?
            user4374420

            Sure.  Some Perl code below.  After running it, I tried "db_hotbackup -h test -b /tmp".

             

            Thanks for looking into it.

             

            -John

             

            -------- before running, do "rm -fr test; mkdir test" --------

            #!/usr/bin/env perl

             

            use 5.006;

            use strict;

            use warnings;

            use DB_File;

             

            my %h;

            my $filename = 'test/test.bdb';

            my $db = tie %h, 'DB_File', $filename, O_RDWR|O_CREAT, 0666, $DB_BTREE or

              die "Cannot open $filename: $!\n";

             

            $h{the} = 'quick';

            $h{brown} = 'fox';

            $h{jumped} = 'over';

             

            undef $db;

            untie %h;

            • 3. Re: Does db_hotbackup work under Linux 3.0?
              userBDBDMS-Oracle

              in your sample code you are not creating an environment.   db_hotbackup is for environments.   Please see documentation for db_hotbackup.  It says "The db_hotbackup utility creates "hot backup" or "hot failover" snapshots of Berkeley DB database environments"   If the OS you are running on meets the conditions, you can try a -F ... This can force a backup of a db file.  see the doc for more detals...

              -F

                Directly copy from the filesystem. This option can  CORRUPT the backup if used while the environment is active and the operating system does not support atomic file system reads. This option is known to be safe only on UNIX systems, not Linux or Windows systems.

              • 4. Re: Does db_hotbackup work under Linux 3.0?
                user4374420

                Thanks for the tip.  I had some success, by converting the sample code to "use BerkeleyDB" (instead of "use DB_File") and explicitly creating an environment.  It was tricky to do because it appears that to create an environment deliberately requires initializing both the transaction and memory pool subsystems (is this documented somewhere?).  It finally worked to create the environment with

                 

                my $env = new BerkeleyDB::Env

                                -Home => 'test',

                                -Flags => DB_CREATE | DB_INIT_TXN | DB_INIT_MPOOL,

                        or die "No env created";


                The odd thing is that I don't need to create an environment on Solaris, OS X, or Amazon Linux, ie, the DB_File sample code I supplied worked with db_hotbackup.  But I do have to create it explicitly on SLES and RedHat.