]> git.sur5r.net Git - bacula/bacula/blob - bacula/manpages/dbcheck.8
Fix manpage errors, fixes bug #1907
[bacula/bacula] / bacula / manpages / dbcheck.8
1 .\"                                      Hey, EMACS: -*- nroff -*-
2 .\" First parameter, NAME, should be all caps
3 .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
4 .\" other parameters are allowed: see man(7), man(1)
5 .TH DBCHECK 8 "26 September 2009" "Kern Sibbald" "Network backup, recovery and verification"
6 .\" Please adjust this date whenever revising the manpage.
7 .\"
8 .SH NAME
9  dbcheck \- Bacula's Catalog Database Check/Clean program
10 .SH SYNOPSIS
11 .B dbcheck
12 .RI [ options ]
13 .I working-directory
14 .I bacula-database
15 .I user
16 .I password
17 .RI [ dbhost ]
18 .RI [ dbport ]
19 .br
20 .SH DESCRIPTION
21 This manual page documents briefly the
22 .B dbcheck
23 command.
24 .PP
25 dbcheck will not repair your database if it is broken. Please see your
26 vendor's instructions for fixing broken database.
27
28 dbcheck is a simple program that will search for logical
29 inconsistencies in the Bacula tables in your database, and optionally fix them.
30 It is a database maintenance routine, in the sense that it can
31 detect and remove unused rows, but it is not a database repair
32 routine. To repair a database, see the tools furnished by the
33 database vendor.  Normally dbcheck should never need to be run,
34 but if Bacula has crashed or you have a lot of Clients, Pools, or
35 Jobs that you have removed, it could be useful.
36 .SH OPTIONS
37 A summary of options is included below.
38 .TP
39 .B \-?
40 Show version and usage of program.
41 .TP
42 .BI \-b
43 If specified, dbcheck will run in batch mode, and it will proceed to examine
44 and fix (if \-f is set) all programmed inconsistency checks. By default,
45 dbcheck will enter interactive mode (see below).
46 .TP
47 .BI \-C\  catalog
48 catalog name in the director conf file.
49 .TP
50 .BI \-c\  config
51 If the \-c option is given with the Director's conf file, there is no need to
52 enter any of the command line arguments, in particular the working directory
53 as dbcheck will read them from the file.
54 .TP
55 .BI \-B
56 print catalog configuration and exit.
57 .TP
58 .BI -d\  nn
59 set debug level to \fInn\fP.
60 .TP
61 .BI \-dt
62 print timestamp in debug output.
63 .TP
64 .BI \-f
65 If specified, dbcheck will repair (fix) the inconsistencies it finds.
66 Otherwise, it will report only.
67 .TP
68 .BI \-v
69 Set verbose mode.
70 .SH INTERACTIVE MODE
71 In interactive mode dbcheck will prompt with the following:
72 .PP
73 Hello, this is the database check/correct program.
74 Please select the function you want to perform.
75      1) Toggle modify database flag
76      2) Toggle verbose flag
77      3) Repair bad Filename records
78      4) Repair bad Path records
79      5) Eliminate duplicate Filename records
80      6) Eliminate duplicate Path records
81      7) Eliminate orphaned Jobmedia records
82      8) Eliminate orphaned File records
83      9) Eliminate orphaned Path records
84     10) Eliminate orphaned Filename records
85     11) Eliminate orphaned FileSet records
86     12) Eliminate orphaned Client records
87     13) Eliminate orphaned Job records
88     14) Eliminate all Admin records
89     15) Eliminate all Restore records
90     16) All (3-15)
91     17) Quit
92 Select function number:
93
94 By entering 1 or 2, you can toggle the modify database flag (\-f option) and
95 the verbose flag (\-v).  It can be helpful and reassuring to turn off the
96 modify database flag, then select one or more of the consistency checks
97 (items 3 through 9) to see what will be done, then toggle the modify flag
98 on and re-run the check.
99
100 The inconsistencies examined are the following:
101
102 .BR
103 Duplicate filename records.  This can happen if you accidentally run two
104    copies of Bacula at the same time, and they are both adding filenames
105    simultaneously.  It is a rare occurrence, but will create an
106    inconsistent database.  If this is the case, you will receive error
107    messages during Jobs warning of duplicate database records.  If you are
108    not getting these error messages, there is no reason to run this check.
109
110 .BR
111 Repair bad Filename records.  This checks and corrects filenames that have
112    a trailing slash.  They should not.
113
114 .BR
115 Repair bad Path records.  This checks and corrects path names that do not
116    have a trailing slash.  They should.
117
118 .BR
119 Duplicate path records.  This can happen if you accidentally run two copies
120    of Bacula at the same time, and they are both adding filenames
121    simultaneously.  It is a rare occurrence, but will create an
122    inconsistent database.  See the item above for why this occurs and how
123    you know it is happening.
124
125 .BR
126 Orphaned JobMedia records.  This happens when a Job record is deleted
127    (perhaps by a user issued SQL statement), but the corresponding JobMedia
128    record (one for each Volume used in the Job) was not deleted.  Normally,
129    this should not happen, and even if it does, these records generally do
130    not take much space in your database.  However, by running this check,
131    you can eliminate any such orphans.
132
133 .BR
134 Orphaned File records.  This happens when a Job record is deleted (perhaps
135    by a user issued SQL statement), but the corresponding File record (one
136    for each Volume used in the Job) was not deleted.  Note, searching for
137    these records can be very time consuming (i.e.  it may take hours) for a
138    large database.  Normally this should not happen as Bacula takes care to
139    prevent it.  Just the same, this check can remove any orphaned File
140    records.  It is recommended that you run this once a year since orphaned
141    File records can take a large amount of space in your database.  You
142    might want to ensure that you have indexes on JobId, FilenameId, and
143    PathId for the File table in your catalog before running this command.
144
145 .BR
146 Orphaned Path records.  This condition happens any time a directory is
147    deleted from your system and all associated Job records have been
148    purged.  During standard purging (or pruning) of Job records, Bacula
149    does not check for orphaned Path records.  As a consequence, over a
150    period of time, old unused Path records will tend to accumulate and use
151    space in your database.  This check will eliminate them.  It is
152    recommended that you run this check at least once a year.
153
154 .BR
155 Orphaned Filename records.  This condition happens any time a file is
156    deleted from your system and all associated Job records have been
157    purged.  This can happen quite frequently as there are quite a large
158    number of files that are created and then deleted.  In addition, if you
159    do a system update or delete an entire directory, there can be a very
160    large number of Filename records that remain in the catalog but are no
161    longer used.
162
163    During standard purging (or pruning) of Job records, Bacula does not
164    check for orphaned Filename records.  As a consequence, over a period of
165    time, old unused Filename records will accumulate and use space in your
166    database.  This check will eliminate them.  It is strongly recommended
167    that you run this check at least once a year, and for large database
168    (more than 200 Megabytes), it is probably better to run this once every
169    6 months.
170
171 .BR
172 Orphaned Client records.  These records can remain in the database long
173    after you have removed a client.
174
175 .BR
176 Orphaned Job records.  If no client is defined for a job or you do not run
177    a job for a long time, you can accumulate old job records.  This option
178    allow you to remove jobs that are not attached to any client (and thus
179    useless).
180
181 .BR
182 All Admin records. This command will remove all Admin records,
183    regardless of their age.
184
185 .BR
186 All Restore records. This command will remove all Restore records,
187    regardless of their age.
188
189 By the way, I personally run dbcheck only where I have messed up
190 my database due to a bug in developing Bacula code, so normally
191 you should never need to run dbcheck inspite of the
192 recommendations given above, which are given so that users don't
193 waste their time running dbcheck too often.
194
195 .SH SEE ALSO
196 .BR bls (1),
197 .BR bextract (1).
198 .br
199 .SH AUTHOR
200 This manual page was written by Jose Luis Tallon
201 .nh
202 <jltallon@adv\-solutions.net>.