dbcheck (8) - Linux Manuals
dbcheck: Bacula's Catalog Database Check/Clean program
NAME
SYNOPSIS
dbcheck [options] working-directory bacula-database user password [dbhost] [dbport]DESCRIPTION
This manual page documents briefly the dbcheck command.dbcheck will not repair your database if it is broken. Please see your vendor's instructions for fixing broken database.
dbcheck is a simple program that will search for logical inconsistencies in the Bacula tables in your database, and optionally fix them. It is a database maintenance routine, in the sense that it can detect and remove unused rows, but it is not a database repair routine. To repair a database, see the tools furnished by the database vendor. Normally dbcheck should never need to be run, but if Bacula has crashed or you have a lot of Clients, Pools, or Jobs that you have removed, it could be useful.
OPTIONS
A summary of options is included below.- -?
- Show version and usage of program.
- -b
- If specified, dbcheck will run in batch mode, and it will proceed to examine and fix (if -f is set) all programmed inconsistency checks. By default, dbcheck will enter interactive mode (see below).
- -C
catalog - catalog name in the director conf file.
- -c
config - If the -c option is given with the Director's conf file, there is no need to enter any of the command line arguments, in particular the working directory as dbcheck will read them from the file.
- -B
- print catalog configuration and exit.
- -d
nn - set debug level to nn.
- -dt
- print timestamp in debug output.
- -f
- If specified, dbcheck will repair (fix) the inconsistencies it finds. Otherwise, it will report only.
- -v
- Set verbose mode.
INTERACTIVE MODE
In interactive mode dbcheck will prompt with the following:
Hello, this is the database check/correct program.
Please select the function you want to perform.
By entering 1 or 2, you can toggle the modify database flag (-f option) and
the verbose flag (-v). It can be helpful and reassuring to turn off the
modify database flag, then select one or more of the consistency checks
(items 3 through 9) to see what will be done, then toggle the modify flag
on and re-run the check.
The inconsistencies examined are the following:
Duplicate filename records. This can happen if you accidentally run two
Repair bad Filename records. This checks and corrects filenames that have
Repair bad Path records. This checks and corrects path names that do not
Duplicate path records. This can happen if you accidentally run two copies
Orphaned JobMedia records. This happens when a Job record is deleted
Orphaned File records. This happens when a Job record is deleted (perhaps
Orphaned Path records. This condition happens any time a directory is
Orphaned Filename records. This condition happens any time a file is
Orphaned Client records. These records can remain in the database long
Orphaned Job records. If no client is defined for a job or you do not run
All Admin records. This command will remove all Admin records,
All Restore records. This command will remove all Restore records,
By the way, I personally run dbcheck only where I have messed up
my database due to a bug in developing Bacula code, so normally
you should never need to run dbcheck inspite of the
recommendations given above, which are given so that users don't
waste their time running dbcheck too often.
copies of Bacula at the same time, and they are both adding filenames
simultaneously.
inconsistent database.
messages during Jobs warning of duplicate database records.
not getting these error messages, there is no reason to run this check.
a trailing slash.
have a trailing slash.
of Bacula at the same time, and they are both adding filenames
simultaneously.
inconsistent database.
you know it is happening.
(perhaps by a user issued SQL statement), but the corresponding JobMedia
record
this should not happen, and even if it does, these records generally do
not take much space in your database.
you can eliminate any such orphans.
by a user issued SQL statement), but the corresponding File record
for each Volume used in the Job)
these records can be very time consuming
large database.
prevent it.
records.
File records can take a large amount of space in your database.
might want to ensure that you have indexes on JobId, FilenameId, and
PathId for the File table in your catalog before running this command.
deleted from your system and all associated Job records have been
purged.
does not check for orphaned Path records.
period of time, old unused Path records will tend to accumulate and use
space in your database.
recommended that you run this check at least once a year.
deleted from your system and all associated Job records have been
purged.
number of files that are created and then deleted.
do a system update or delete an entire directory, there can be a very
large number of Filename records that remain in the catalog but are no
longer used.
During standard purging
check for orphaned Filename records.
time, old unused Filename records will accumulate and use space in your
database.
that you run this check at least once a year, and for large database
(more than 200 Megabytes), it is probably better to run this once every
6 months.
after you have removed a client.
a job for a long time, you can accumulate old job records.
allow you to remove jobs that are not attached to any client
useless).
regardless of their age.
regardless of their age.
AUTHOR
This manual page was written by Jose Luis Tallon
<jltallon [at] adv-solutions.net>.