PDA

View Full Version : All Database Errors (affecting login and other areas) have now been fixed.



Andres Kello
12-30-2009, 01:40 PM
Hi Folks,

Just a quick update to let you know that all DB problems should have now been fixed.

One of the DB Tables had crashed and the host just repaired it.

Please let me know if you're still getting errors.

Pred
12-30-2009, 02:07 PM
phew
good job getting fixed mate
first time been able to log on all day

newton
12-30-2009, 02:49 PM
Snap :)

andymoore
12-31-2009, 08:13 AM
You shouldn't have to wait for your host, repairing a table is easy enough if you have access to phpmyadmin

From there you tick the table, select repair from the list and you're done!

Or.... Schedule an hourly cron, check table status, if overhead or need to repair ect do it and if that fails have it email you so you can follow it up manually.

But.... If that works it should auto fix itself within an hour or tell you about the error first hand.

It only effect me for a couple of pages yesterday, nice it's back now tho!

:)

andymoore
12-31-2009, 09:37 AM
A wee script to optimise tables with overhead:

$db = mysql_connect('','','');
mysql_select_db('',$db);

$result = mysql_query('show table status');
$num = mysql_numrows($result);

while ($i < $num) {
echo '<b> '.mysql_result($result,$i,"Name").'</b><br />';
echo 'Rows: '.number_format(mysql_result($result,$i,"Rows")).'<br />';
echo 'Index size: '.number_format(mysql_result($result,$i,"Index_length")).'<br />';
if(($overhead = mysql_result($result,$i,"Data_free")) > 0){
echo 'Overhead: '.number_format($overhead).'<br />';
if(mysql_query('OPTIMIZE TABLE ' . mysql_result($result,$i,"Name"))){
echo 'Table optimized!<br />';
}else{
echo 'Unable to optimise table<br />';
}
}else{
echo 'No overhead';
}
echo '<hr />';
ob_flush();
flush();
++$i;
}

mysql_close();

That's just a hack to keep overhead down, if you want something which will check table status and run repairs if needed check out this link which seems to do the job:

http://www.purplepixie.org/myrep/source.php

Databases can be *******, nice bits of code like this give them the slap they need every so often!

;)