Re: bcheck in a Unix cron job produces error
Posted in 1995
In article <3t1ot2$gb1@miso.wwa.com> john@miso.wwa.com "pinoy_ako" writes: >> We have SE v5.12 and ISQL/I4GL v4.12. I have set up a cron job >> in Unix to do a bcheck on all the files in the >> $DBPATH/[database-name].dbs directory at 3:00 AM Monday to Friday. >> The result is mailed to me. My problem is that the output includes the >> following line: >> >> ERROR: bad data record >> >> My questions are: >> >> 1. Does anyone know what causes this? > Sally Woolrich (sally@excelsis.demon.co.uk) replied: > >Yes it's a corruption. Not necessarily.... Another common cause of this exact problem (bad data record) is that someone is simply accessing one of the tables, or even another table in the same list of tables being checked by the same bcheck process. (If you don't believe it, run bcheck on a db with a bunch of tables, and run a 4gl against the db and start reading records. You will see not only bad data record errors on the file being read by the 4gl, but also on subsequent tables checked by the same bcheck process.) The point is, a "bad data record" error DOES NOT always imply that there has been corruption. Instead, when you see this error, you should make sure that there are no users running against the db (something you should probably be doing anyway before the bcheck starts) and try it again. One other thing to remember, an easy 'gotcha" is that there can be another cron job that is the culprit running a process against the db you are checking. Thus, simply blocking users with something like a nologin is not sufficient. We have implemented the simplest of locking schemes to handle this, whereby we have lock files for each of our db's, and all 4gls, and scripts running sqls or ace reports check for the presence of the lock file, and sleep until the lock file goes away. Then, all you need to do is put up the lock file, kill any users, and run the bcheck (thus eliminating the worry about jobs starting while you are running bcheck). Hope this helps. ------------------------------------------------------------------------ Gregory King Phone 718.526.2300 Director-MIS Fax 718.526.2584 International Bonded Couriers, Inc. email: gking@ibcinc.com ------------------------------------------------------------------------