<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi all,<br>
    <br>
    Just got done pulling off a (very) minor miracle, but thought I'd
    document it in the hopes that someone else in the same boat finds it
    useful. <br>
    <br>
    We've been having performance problems for over a week, and I
    finally got around to checking the correct logs, and discovered that
    we had a corrupt page in one of those lesser used koha tables,
    something called biblio :-/ <br>
    <br>
    Of course, since I'd let it slide for over a week, bringing biblio
    back from backup would have meant lots of re-work for any cataloging
    done since the corruption began.<br>
    <br>
    Because of the corrupt page, whenever a request was made against
    that particular page, the mysql database would restart, dropping the
    connections and causing general chaos. And thanks to google's robot,
    that corrupt page was getting hit pretty regularly as it turns out.<br>
    <br>
    Some googling gave me an idea of how to retrieve what I could from
    the table (think binary search), finding the edges of the corrupt
    page. I ended up being able to recover all of the biblio records
    from 1-30227, and from 30313-91859, leaving a gap of 85 missing
    biblios.<br>
    <br>
    I could have made our library technician (hi Katie) rebuild those
    records by hand, but biblioitems has all of the required information
    stored in the marcxml field. Thanks to prior questions being asked
    and answered on the list, I was able to put together the following
    query to recreate the missing records. <br>
    <br>
    insert into biblio<br>
    select biblionumber, '' framework, <br>
    &nbsp;
    extractValue(marcxml,"record/datafield[@tag='100'][1]/subfield[@code='a']")
    author,<br>
    &nbsp;
    extractValue(marcxml,"record/datafield[@tag='245'][1]/subfield[@code='a']")
    title,<br>
    &nbsp; NULL, NULL, <br>
    &nbsp;
    extractValue(marcxml,"record/datafield[@tag='440'][1]/subfield[@code='a']")
    REGEXP '[a-zA-Z]' series, <br>
    &nbsp;
    extractValue(marcxml,"record/datafield[@tag='440'][1]/subfield[@code='a']")
    series_title,<br>
    &nbsp;
    substring(extractValue(marcxml,"record/datafield[@tag='260'][1]/subfield[@code='c']"),2,4)
    copyright,<br>
    &nbsp; NULL,<br>
    &nbsp; '2010-07-23',<br>
    &nbsp;
    extractValue(marcxml,"record/datafield[@tag='520'][1]/subfield[@code='a']")
    abstract<br>
    from biblioitems where biblionumber &gt;= 30228 and biblionumber
    &lt;= 30312;<br>
    <br>
    Hope somebody else finds this useful!<br>
    <br>
    <div class="moz-signature">-- <br>
      <font color="blue">Chris Hobbs</font><br>
      Director, Technology<br>
      New Haven Unified School District</div>
  --
This message has been checked by ESVA and is believed to be clean.
</body>
</html>