---------- Forwarded message ----------
From: Frank Altpeter <frank.altpeter@...>
Date: Feb 20, 2007 7:00 PM
Subject: Re: [Bacula-users] Cleaning up database records
To: Kern Sibbald <kern@...>
I'm running dbcheck periodically every sunday with the following script:
---------------------------------------------------------------------------=
---------------------
#!/bin/sh
PATH=3D"/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin"
echo "$(date) Creating temp indices for bacula database..."
mysql -ubacula <<EOFA
use bacula
CREATE INDEX file_tmp_filenameid_idx ON File (FilenameId);
CREATE INDEX file_tmp_pathid_idx ON File (PathId);
EOFA
echo "$(date) Running dbcheck..."
dbcheck -c /usr/local/etc/bacula-dir.conf -f -b -v
echo "$(date) Removing indices and optimizing bacula database..."
mysql -ubacula <<EOFB
use bacula
DROP INDEX file_tmp_filenameid_idx ON File;
DROP INDEX file_tmp_pathid_idx ON File;
OPTIMIZE TABLE UnsavedFiles, Counters, CDImages, BaseFiles, Device,
Version, Status, MediaType, Storage, FileSet, Client, Pool, Media,
Job, JobMedia, File, Path, Filename;
EOFB
echo "$(date) Done..."
---------------------------------------------------------------------------=
---------------------
Due to the additional index entries, the script runs for about 90
minutes (eternally without them) with a database of 24 million file
entries from 88 clients, mostly application servers.
It helps a lot, but still it doesn't help against orphaned entries
from previously removed clients.
--
Le deagh dh=F9raghd,
Frank Altpeter
Two of the most famous products of Berkeley are LSD and Unix.
I don't think that this is a coincidence.
-- Anonymous
--=20
Le deagh dh=F9raghd,
Frank Altpeter
Two of the most famous products of Berkeley are LSD and Unix.
I don't think that this is a coincidence.
-- Anonymous
|