* Robert > It seems that the .FRM file for one of my largest tables has disappeared. > 180 million rows. I am not so much concerned about finding out WHY it was > deleted as I am trying to figure out how to recover the table. > > I've tried making a new table using a similar data structure (the table is > only three columns wide) and then using it's .FRM file as a definition. > However, I cannot seem to get it quite right.
You are on the right track...: <URL: http://www.mysql.com/doc/en/Repair.html > Stage 4, "Very difficult repair", point 2. > The table is integer, integer, and then a varchar() or enum(). I can usually > get the varchar/enum column correct, but the first two ints are giving me > hassle. Whoops. Then we are beyond "Very difficult repair", maybe an "extremely difficult repair"...? ;) Do you know the max values? Do you know the combined width in the .MYD file for these two columns? (16 = bigint+bigint, 12 = bigint+mediumint ... 2 = tinyint+tinyint) By inspecting the start of the .MYD file you should be able to see the record length... look for repeating byte sequences and known values... could be tricky, but I don't know another way. If the third column is a varchar, you should see the string values, and you will have a variable record length. If it is a enum there will be binary values, 1, 2, 4 or 8 bytes could be used, depending on the number of values in the enum. Note that the string values of enum columns are _only_ stored in the .frm file, the data file only contains an integer poining to the correct string. In other words, you have to reconstruct these strings somehow, if it is an enum. > I know I used a combination of different integer types to conserve space > (some of the numbers will never be higher than 100K or so). However, I > cannot determine *what* integer types I've used. I always use unsigned, but > I cannot recall if I used NOT NULL with a default value. When there are only three columns, the NULL flags will not take any space, i.e. the same byte as is used for the deletion flag is also used for the NULL flags. In other words, it does not change the physical record length. > Is there any way to solve this without trying the hundreds of permutations > of integer definitions? Not so many combinations if you can find the combined width... integers can be 1, 2, 3, 4 or 8 bytes: width permutations 3 1+2,2+1 4 1+3,2+2,3+1 5 1+4,2+3,3+2,4+1 6 2+4,3+3,4+2 7 3+4,4+3 8 4+4 9 1+8,8+1 If the combined width is 5, you must test 4 combinations. Note that all of them will work technically, i.e. you won't get errors, but only one of them will give you the right data in the columns. Good luck! -- Roger -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]