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