On Tuesday 23 October 2001 13:50, David Potter wrote:
> Dear list members,
>
> We are running Mysql 3.23 on Redhat Linux 7.1.
>
> We have an emergency. This is the first time we have ever had a problem. 
> Our production database suddenly crashed.  I have tried to repair the
> tables with myisamchk commands, -r, -o, etc and nothing works.
>
> Here is the output:
>
> myisamchk: error: 'journal.frm' doesn't have a correct index definition.
> You need to recreate it before you can do a repair myisamchk: error:
> 'journal.MYD' doesn't have a correct index definition. You need to recreate
> it before you can do a repair
>
> Our first choice would be to repair the above tables.  But if this is too
> hard, our next best option would be to just create a new database and
> restore the data from one of our backups.  So then I tried to create a new
> database.  Even that does not work.  I enter "drop database deptpros" and
> the system just hangs.  I then tried "create database prod" and the system
> just hangs again.
>
> Thank you

You might want to try running myisamchk with the -k0 arguments.  This turns 
of all the indexes.  I don't know if that will cause it to skip the back 
indexes, but it might.

If you can get the .frm and .MYI files for these tables from a backup, that 
might work too.  The .MYI can be "out of sync" with the data in the table.  
That is what myisamchk is for.  Also, make sure that you are not running 
myisamchk while the database is running.  Later versions might allow that, I 
can't remember, but earlier ones do not.  Once you overwrite the MYI and frm 
files (_NOT_ the MYD since that has your data!), you can run myisamchk.  I 
would use the -rv flags if the version of MySQL is rather aged.  There was a 
bug a long time ago that was worked around with the "-rv" flag combination.  
Just "-r" would cause data loss :-(

Here's the process:

1) assume that a damaged table is A.  Get A.MYI from the backup and A.frm 
from the backup.   Call these A_bak.MYI and A_bak.frm.

2) stop the database.

3) make a backup somewhere of the damaged A.MYI.

4) make a backup somewhere of the damaged A.frm.

5) make a backup somewhere of the damaged A.MYD.

6) copy A_bak.MYI over A.MYI.

7) copy A_bak.frm over A.frm.

8) run myisamchk against A.

9) If it worked, do this with the other damaged tables.

I'd pick a smallish table to try this on first so that you can see if it is 
going to work at all.  If it doesn't work, you'll probably have to recover 
from your original backup tapes.  Or...

If you cannot get the MYI and frm files back from the backup, then follow 
this process, it _MIGHT_ work (no warranty, void where prohibited by law, may 
cause cancer in small laboratory animals, not responsible for anything, 
anywhere):

1) say the table that is damaged is A.  Make a new table A_new that has 
exactly the same fields and indexes in _exactly_ the same order as the 
original table.

2) stop the database.

3) copy A_new.MYI over A.MYI (after you've made backups of A.MYI of course!).

4) copy A_new.frm over A.frm (again, make those backups first!).

5) run myisamchk -r again. 

6) if that does not work, try -o.  I would put -v in there too just so that 
you can get a feeling for what it is doing.  make sure that you can save all 
the output as it will just keep going.

If this works, then do it with the other tables that are missing.  This is 
dangerous.  I would only use this if you are certain that the backups cannot 
be used for a complete rebuild or for the trick I suggested above.

I assume that you are using MyISAM tables here since you have *.MYD files.

MySQL just doesn't corrupt its database much.  If you are seeing this kind of 
corruption, it usually appears to be disk errors, disk controller errors or 
bad memory (not necessarily in order).  Run the memtest86 program that is 
floating around out there (SuSE has it as a boot option, don't use Red Hat 
anymore so I can't say for it).

Best,
Kyle

P.S. buy support from mysql.com.  You can get a reasonable level of support 
(email) for less than $200 per _year_.  From experience, they are very 
responsive and helpful.  How much money did this database problem lose your 
company?  That $200 sounds cheap doesn't it?

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MicroTelco Services saves money on every Fax:
- Fax to email (FREE)
- Fax to PSTN based Fax (Up to 95% Savings)
- Fax Broadcasting: Send 100s of faxes to fax machines
and email addresses in the time it takes to send just one!
===========================================================
    So send a fax today and let us know what you think! 
       For more info. visit: www.internetfaxjack.com
===========================================================


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to