On Wed, Feb 24, 2010 at 5:44 AM, Robert P. J. Day <span dir="ltr"><<a href="mailto:rpjday@crashcourse.ca">rpjday@crashcourse.ca</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
  a colleague asks me if there's a way to recover a mysql database<br>
that was being hosted by someone else and was apparently corrupted in<br>
ways that are not at all obvious.<br>
<br>
  all the hosting company is providing him with is a tar file of the<br>
/var/lib/mysql/<db> directory, which consists of nothing but .frm<br>
files (so it's in innodb format, correct?).  </blockquote><div><br>Apparently, yes.<br><br>The .frm files are the table definitions only. No data in them.<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
they won't give him the<br>
ibdata1 file or ib log files, for security reasons.<br></blockquote><div><br>Because they did not set the innodb-file-per-table parameter, and hence<br>the ibdata file contains the data of every database on that machine, so<br>
it would be inappropriate to give it to someone.<br><br>If they did have innodb-file-per-table, there would be data as .ibd for each<br>table in the same directory as the .frm file.<br><br>Recovering from this is not easy still. InnoDB still writes stuff to the ibdata<br>
files.<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
  as a trivial test, i simply untarred the db .frm files under *my*<br>
/var/lib/mysql directory and fired up mysql.  "show databases;" sees<br>
the alleged database, i can switch to it, "show tables;" also lists<br>
all the tables, but if i try to describe a table:<br>
<br>
mysql> desc <table name>;<br>
ERROR 1146 (42S02): Table '<db name>.<table name>' doesn't exist<br>
mysql><br>
<br>
  not at all surprising since there is no record of this database on<br>
my system in the ibdata1 file.  that's all he's got, and he'd really<br>
like to recover the data in that database, but his hosting company<br>
won't provide him with any further information or data, and they<br>
apparently don't have backups with which to restore.<br></blockquote><div><br>That is the sad part. He has to run dumps daily to have backups he could<br>recover to, or move his data to another host if the need arises.<br>
 <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
  so ... i'm by no means a mysql expert, is there anything that can be<br>
done with nothing but the directory of .frm files?<br></blockquote><div><br>No. .frm are only table definitions. The only thing you can do with it is<br>run TRUNCATE tablename and it will recreate an empty table.<br><br>
This is really inexcusable, because of the lack of backups. <br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
rday<br>
--<br>
<br>
========================================================================<br>
Robert P. J. Day                               Waterloo, Ontario, CANADA<br>
<br>
            Linux Consulting, Training and Kernel Pedantry.<br>
<br>
Web page:                                          <a href="http://crashcourse.ca" target="_blank">http://crashcourse.ca</a><br>
Twitter:                                       <a href="http://twitter.com/rpjday" target="_blank">http://twitter.com/rpjday</a><br>
========================================================================<br>
<br>
_______________________________________________<br>
<a href="http://kwlug-disc_kwlug.org" target="_blank">kwlug-disc_kwlug.org</a> mailing list<br>
<a href="http://kwlug-disc_kwlug.org" target="_blank">kwlug-disc_kwlug.org</a>@<a href="http://kwlug.org" target="_blank">kwlug.org</a><br>
<a href="http://astoria.ccjclearline.com/mailman/listinfo/kwlug-disc_kwlug.org" target="_blank">http://astoria.ccjclearline.com/mailman/listinfo/kwlug-disc_kwlug.org</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Khalid M. Baheyeldin<br><a href="http://2bits.com">2bits.com</a>, Inc.<br><a href="http://2bits.com">http://2bits.com</a><br>Drupal optimization, development, customization and consulting.<br>
Simplicity is prerequisite for reliability. --  Edsger W.Dijkstra<br>Simplicity is the ultimate sophistication. --   Leonardo da Vinci<br>