SYNOPSIS

       bcopy [options] working-directory bacula-database user password


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  inconsisten-
       cies  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.

       It is called:

       Usage: dbcheck [-c config] [-C catalog name] [-d debug_level]     []
              -b              batch mode
              -C              catalog name in the director conf file
              -c              director conf filename
              -dnn            set debug level to nn
              -f              fix inconsistencies
              -v              verbose
              -?              print this message

       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.

       If  the -f option is specified, dbcheck will repair (fix) the inconsis-
       tencies it finds. Otherwise, it will report only.

       If the -b option is specified, dbcheck will run in batch mode,  and  it
       will proceed to examine and fix (if -f is set) all programmed inconsis-
       tency checks. If the -b option is not  specified,  dbcheck  will  enter
       interactive mode and prompt with the following:

       Hello,  this  is the database check/correct program.  Please select the
       function you want to perform.
            1) Toggle modify database flag
            2) Toggle verbose flag
            3) Repair bad Filename records
            4) Repair bad Path records
            5) Eliminate duplicate Filename records
            6) Eliminate duplicate Path records
            7) Eliminate orphaned Jobmedia records
            8) Eliminate orphaned File records
            9) Eliminate orphaned Path records

       The inconsistencies examined are the following:


          Duplicate filename records. This can happen if you accidentally  run
       two
          copies  of  Bacula at the same time, and they are both adding  file-
       names
          simultaneously. It is a rare occurrence, but will create  an  incon-
       sistent
          database. If this is the case, you will receive  error messages dur-
       ing Jobs
          warning of duplicate database records.  If you are not getting these
       error
          messages, there is no reason  to run this check.

        Repair bad Filename records. This checks and corrects filenames  that
          have a trailing slash. They should not.

        Repair bad Path records. This checks and corrects path names  that do
          not have a trailing slash. They should.

        Duplicate path records. This can happen if you accidentally run  two
          copies  of  Bacula at the same time, and they are both adding  file-
       names
          simultaneously. It is a rare occurrence, but will create  an  incon-
       sistent
          database.  See  the item above for why this occurs and  how you know
       it is                    v
          happening.            e
                                r
        Orphaned JobMedia recordy. This happens when a Job record is deleted
          (perhaps by a user iss}ed  SQL  statement),  but  the  corresponding
       JobMedia                 t
          record  (one for each iolume used in the Job) was not deleted.  Nor-
       mally, this              m
          should not happen, andeeven if it does, these records  generally  do
       not take                 c
          much  space  in  your oatabase. However, by running  this check, you
       can                      n
          eliminate any such orpsans.
                                u
        Orphaned File records. Tmis happens when a Job record is deleted
          (perhaps by a user issied  SQL  statement),  but  the  corresponding
       File record              n
          (one  for  each  Volumg  used  in  the  Job) was not deleted.  Note,
       searching for            (
          these records can be {ior a
          large database. Normally this should not   happen  as  Bacula  takes
       care to                  e
          prevent  it. Just the same, this  check can remove any orphaned File
       records.                 i
        Orphaned Path records. This condition happens any time a directory is
          deleted  from  your  system and all associated Job records have been
       purged.
          During standard purging (or pruning) of  Job  records,  Bacula  does
       not check
          for orphaned Path records. As a consequence, over a period  of time,
       old
          unused Path records will tend to accumulate and use  space  in  your
       database.
          This check will eliminate them. It is recommended that you run this
          check at least once a year.

        Orphaned Filename records. This condition happens any time a file is
          deleted  from  your  system and all associated Job records have been
       purged.
          This can happen quite frequently as there are quite a  large  number
       of files
          that  are created and then deleted. In addition, if you  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  (or  pruning) of Job records, Bacula does
       not check
          for orphaned Filename records. As a consequence, over a  period   of
       time, old
          unused Filename records will accumulate and use  space in your data-
       base. This
          check will eliminate them. It is strongly  recommended 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.

        Orphaned Client records. These records  can  remain  in  the  database
       long
          after you have removed a client.

        Orphaned Job records. If no client is defined for a job or you  do not
          run a job for a long time, you can accumulate old job  records. This
       option
          allow  you  to remove jobs that are not  attached to any client (and
       thus
          useless).

        All Admin records. This command will remove all Admin records,
          regardless of their age.

        All Restore records. This command will remove all Restore records,
          regardless of their age.



Kern Sibbald                      26 May 2006                       DBCHECK(8)

Man(1) output converted with man2html