Maintaining BerkeleyDB Databases

Introduction

j-chkmail uses two kinds of databases :

  • CDB (constant databases) -
  • WDB (working databases) -

j-makemap tool

BerkeleyDB command line tools

BerkeleyDB package come with some command line tools to help you maintaining j-chkmail databases :

  • db_archive
  • db_checkpoint
  • db_deadlock
  • db_dump
  • db_hotbackup
  • db_load
  • db_printlog
  • db_recover
  • db_stat
  • db_upgrade
  • db_verify

These tools are installed inside /var/jchkmail/dbtools. Documentation for these tools can be find at BerkeleyDB utilities documentation, at the library distribution or at Oracle web site.

Database Hot-Backup

A good thing is to periodically backup working databases. You can use db_hotbackup, launched by cron :

10 0,6,12,18 * * *      cd /var/jchkmail; bin/backup-wdb

Where backup-wdb script is as follows :

#! /bin/sh

cd /var/jchkmail
dbtools/db_hotbackup -v  -h wdb -b backup-me
chown -hR smmsp:smmsp backup-me
chmod 660 backup-me/log*
chmod 664 backup-me/*db

To restore working databases if they become corrupted, just replace the contents of working database directory (/var/jchkmail/wdb) by the backup :

#! /bin/sh
/etc/init.d/jchkmail stop
cd /var/jchkmail
rm -f wdb/*
cp -p backup-me/* wdb/
/etc/init.d/jchkmail start

Notes

j-chkmail uses BerkeleyDB database manager. To avoid compatibility problems with other possibly already installed versions, BerkeleyDB source code is distributed with j-chkmail, without its documentation, to reduce size. You can get all original BerkeleyDB stuff from Oracle.
doc/maintaining/databases.txt · Last modified: 2008/03/04 08:54 by lalot
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0