<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: Serious MySQL table repair help</title>
	<link>http://ask.metafilter.com/106888/Serious-MySQL-table-repair-help/</link>
	<description>Comments on Ask MetaFilter post Serious MySQL table repair help</description>
	<pubDate>Sat, 15 Nov 2008 14:13:34 -0800</pubDate>
	<lastBuildDate>Sat, 15 Nov 2008 14:13:34 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: Serious MySQL table repair help</title>
		<link>http://ask.metafilter.com/106888/Serious-MySQL-table-repair-help</link>	
		<description>Are there uncommon ways to repair a corrupt MySQL table? I have a MySQL database that is experiencing some serious corruption. Using the &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/repair.html&quot;&gt;standard instructions&lt;/a&gt;, I have repaired all of the tables but one. No matter how many ways I try those instructions on the ornery table, in all cases either a) nothing happens or b) the data file is emptied, which is, obviously, not the result I want. &lt;br /&gt;&lt;br /&gt; I linked to the instructions above because I wanted to make it plain I have tried *all* of the instructions there, on two different servers (one BSD, one Mac OS X), and have had no joy including use of &quot;REPAIR TABLE tbl_name USE_FRM&quot;). Also, I do not have a good backup. I have only the corrupt database table to work with (it&apos;s somebody else&apos;s server--they are highly unsavvy).&lt;br&gt;
&lt;br&gt;
In its default corrupt state, I get the following when I check the file:&lt;br&gt;
&lt;br&gt;
&lt;code&gt;check  	warning  	Size of datafile is: 4791392       Should be: 0&lt;br&gt;
check 	error 	Wrong bytesec: 0-0-0 at linkstart: 0&lt;br&gt;
check 	error 	Corrupt&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
The &quot;should be&quot; size is wrong. This means there&apos;s some discrepancy between the MYD, MYI, and .FRM files. If I repair the file with MySQL, I get&lt;br&gt;
&lt;br&gt;
&lt;code&gt;repair  	info  	Wrong bytesec:   0-  0-  0 at 0; Skipped&lt;br&gt;
repair 	status 	OK&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
This makes the file 0 bytes, which is wrong. Then I restore the copy of the corrupt file and try all the steps on the &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/repair.html&quot;&gt;MySQL repair page&lt;/a&gt;. They do not solve the problem, so I am looking for other ideas and other solutions.</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2008:site.106888</guid>
		<pubDate>Sat, 15 Nov 2008 13:22:20 -0800</pubDate>
		<dc:creator>Mo Nickels</dc:creator>
		
			<category>corrupt</category>
		
			<category>mysql</category>
		
			<category>table</category>
		
			<category>database</category>
		
			<category>repair</category>
		
			<category>corruption</category>
		
	</item> <item>
		<title>By: orthogonality</title>
		<link>http://ask.metafilter.com/106888/Serious-MySQL-table-repair-help#1542219</link>	
		<description>Right, you&apos;re using the repair options available when the serve is running. Have you tried stopping the server and using myisamchk directly on the .MYI file?&lt;br&gt;
&lt;br&gt;
Please include all that you&apos;ve done, by copying the shell/ mysql command command and any output.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.106888-1542219</guid>
		<pubDate>Sat, 15 Nov 2008 14:13:34 -0800</pubDate>
		<dc:creator>orthogonality</dc:creator>
	</item><item>
		<title>By: sbutler</title>
		<link>http://ask.metafilter.com/106888/Serious-MySQL-table-repair-help#1542242</link>	
		<description>Well, first thing you should do is shutdown MySQL and backup the affected files. It&apos;s not unheard of for MySQL to truncate a file while performing a repair.&lt;br&gt;
&lt;br&gt;
Then you need do what orthogonality suggests. Some additional info might be helpful: MySQL version, BSD/OS X versions, what filesystems are involved (obviously HFS+ for OS X, but is journaling enabled?). For example, XFS likes to zero out files on recovery that have suspect metadata.&lt;br&gt;
&lt;br&gt;
Also, what do you think led to this corruption? Bad disks? Bad memory? Crashed MySQL? Crashed server OS?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.106888-1542242</guid>
		<pubDate>Sat, 15 Nov 2008 14:41:32 -0800</pubDate>
		<dc:creator>sbutler</dc:creator>
	</item><item>
		<title>By: Mo Nickels</title>
		<link>http://ask.metafilter.com/106888/Serious-MySQL-table-repair-help#1542388</link>	
		<description>I&apos;m indeed working on these files outside of a running MySQL instance but did try them on a running instance, just to see.&lt;br&gt;
&lt;br&gt;
I speculate that updating the server from MySQL 4 to 5 did the damage, but the ISP, Pair, won&apos;t admit it. Mac OS X is only being used to repair the file. It was not the system in use when the file was corrupted. I do not currently have the information on the corrupting system and what it was running.&lt;br&gt;
&lt;br&gt;
Here&apos;s the last batch of attempts, though there were many, many others; these are just the ones still in my scrollback. The table in question is pm_weblog. The file was replaced before each attempt below with a copy of the corrupted version.&lt;br&gt;
&lt;br&gt;
%  /bin/myisamchk -r -q pm_weblog&lt;br&gt;
- check record delete-chain&lt;br&gt;
- recovering (with sort) MyISAM-table &apos;pm_weblog&apos;&lt;br&gt;
Data records: 0&lt;br&gt;
- Fixing index 1&lt;br&gt;
Wrong bytesec:   0-  0-  0 at          0; Skipped&lt;br&gt;
MyISAM-table &apos;pm_weblog&apos; is not fixed because of errors&lt;br&gt;
Try fixing it by using the --safe-recover (-o), the --force (-f) option or by not using the --quick (-q) flag&lt;br&gt;
&lt;br&gt;
%  /bin/myisamchk --safe-recover pm_weblog&lt;br&gt;
- recovering (with keycache) MyISAM-table &apos;pm_weblog&apos;&lt;br&gt;
Data records: 0&lt;br&gt;
Wrong bytesec:   0-  0-  0 at          0; Skipped&lt;br&gt;
&lt;br&gt;
%  /bin/myisamchk -r pm_weblog&lt;br&gt;
- recovering (with sort) MyISAM-table &apos;pm_weblog&apos;&lt;br&gt;
Data records: 0&lt;br&gt;
- Fixing index 1&lt;br&gt;
Wrong bytesec:   0-  0-  0 at          0; Skipped&lt;br&gt;
&lt;br&gt;
%  /bin/myisamchk -f pm_weblog&lt;br&gt;
Checking MyISAM file: pm_weblog&lt;br&gt;
Data records:       0   Deleted blocks:       0&lt;br&gt;
myisamchk: warning: Table is marked as crashed and last repair failed&lt;br&gt;
- check file-size&lt;br&gt;
myisamchk: warning: Size of datafile is: 4791392         Should be: 0&lt;br&gt;
- check record delete-chain&lt;br&gt;
- check key delete-chain&lt;br&gt;
- check index reference&lt;br&gt;
- check data record references index: 1&lt;br&gt;
- check record links&lt;br&gt;
myisamchk: error: Wrong bytesec: 0-0-0 at linkstart: 0&lt;br&gt;
- recovering (with sort) MyISAM-table &apos;pm_weblog&apos;&lt;br&gt;
Data records: 0&lt;br&gt;
- Fixing index 1&lt;br&gt;
Wrong bytesec:   0-  0-  0 at          0; Skipped&lt;br&gt;
&lt;br&gt;
%  /bin/myisamchk --safe-recover pm_weblog/MYI&lt;br&gt;
myisamchk: error: File &apos;pm_weblog/MYI&apos; doesn&apos;t exist&lt;br&gt;
&lt;br&gt;
%  /bin/myisamchk --safe-recover pm_weblog.MYI&lt;br&gt;
- recovering (with keycache) MyISAM-table &apos;pm_weblog.MYI&apos;&lt;br&gt;
Data records: 0&lt;br&gt;
Wrong bytesec:   0-  0-  0 at          0; Skipped&lt;br&gt;
&lt;br&gt;
%  /bin/myisamchk -r -q pm_weblog&lt;br&gt;
- check record delete-chain&lt;br&gt;
- recovering (with sort) MyISAM-table &apos;pm_weblog&apos;&lt;br&gt;
Data records: 0&lt;br&gt;
- Fixing index 1&lt;br&gt;
Wrong bytesec:   0-  0-  0 at          0; Skipped&lt;br&gt;
MyISAM-table &apos;pm_weblog&apos; is not fixed because of errors&lt;br&gt;
Try fixing it by using the --safe-recover (-o), the --force (-f) option or by not using the --quick (-q) flag&lt;br&gt;
&lt;br&gt;
%  /bin/myisamchk --safe-recover pm_weblog&lt;br&gt;
- recovering (with keycache) MyISAM-table &apos;pm_weblog&apos;&lt;br&gt;
Data records: 0&lt;br&gt;
Wrong bytesec:   0-  0-  0 at          0; Skipped&lt;br&gt;
&lt;br&gt;
%  /bin/myisamchk -e *.MYI &lt;br&gt;
myisamchk: error: &apos;pm_weblog.MYI&apos; is not a MyISAM-table&lt;br&gt;
&lt;br&gt;
%  /bin/myisamchk -r -q pm_weblog&lt;br&gt;
- check record delete-chain&lt;br&gt;
- recovering (with sort) MyISAM-table &apos;pm_weblog&apos;&lt;br&gt;
Data records: 0&lt;br&gt;
- Fixing index 1&lt;br&gt;
Wrong bytesec:   0-  0-  0 at          0; Skipped&lt;br&gt;
MyISAM-table &apos;pm_weblog&apos; is not fixed because of errors&lt;br&gt;
Try fixing it by using the --safe-recover (-o), the --force (-f) option or by not using the --quick (-q) flag&lt;br&gt;
&lt;br&gt;
%  /bin/myisamchk -o pm_weblog&lt;br&gt;
- recovering (with keycache) MyISAM-table &apos;pm_weblog&apos;&lt;br&gt;
Data records: 0&lt;br&gt;
Wrong bytesec:   0-  0-  0 at          0; Skipped&lt;br&gt;
&lt;br&gt;
%  /bin/myisamchk -r -f pm_weblog&lt;br&gt;
- recovering (with sort) MyISAM-table &apos;pm_weblog&apos;&lt;br&gt;
Data records: 0&lt;br&gt;
- Fixing index 1&lt;br&gt;
Wrong bytesec:   0-  0-  0 at          0; Skipped</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.106888-1542388</guid>
		<pubDate>Sat, 15 Nov 2008 18:28:10 -0800</pubDate>
		<dc:creator>Mo Nickels</dc:creator>
	</item><item>
		<title>By: orthogonality</title>
		<link>http://ask.metafilter.com/106888/Serious-MySQL-table-repair-help#1542829</link>	
		<description>I got nothing; can you try recovery using MySQL 4.0 tools?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.106888-1542829</guid>
		<pubDate>Sun, 16 Nov 2008 11:20:39 -0800</pubDate>
		<dc:creator>orthogonality</dc:creator>
	</item><item>
		<title>By: orthogonality</title>
		<link>http://ask.metafilter.com/106888/Serious-MySQL-table-repair-help#1542830</link>	
		<description>Or by looking at the  raw data in a hex editor and seeing if there&apos;s any recoverable structure?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.106888-1542830</guid>
		<pubDate>Sun, 16 Nov 2008 11:21:30 -0800</pubDate>
		<dc:creator>orthogonality</dc:creator>
	</item><item>
		<title>By: Mo Nickels</title>
		<link>http://ask.metafilter.com/106888/Serious-MySQL-table-repair-help#1574339</link>	
		<description>It turned out that the data was beyond recoverable.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.106888-1574339</guid>
		<pubDate>Tue, 16 Dec 2008 03:37:56 -0800</pubDate>
		<dc:creator>Mo Nickels</dc:creator>
	</item>
	</channel>
</rss>
