Fix “Table ‘./eximstats/sends’ is marked as crashed and should be repaired”

autodesk.typepad.com

Hello Friends,

How are you?

Today I am going to show how to fix the issue with the Table ‘./eximstats/sends‘.

Explanation:

When I wanted to run the report for delivery mails in cPanel, I got the following error:

DeliveryReporter API internal failure: Cpanel::Exception::Database::Error/(XID wnnmyw) Database Error: Table './eximstats/sends' is marked as crashed and last (automatic?) repair failed at /usr/local/cpanel/Cpanel/Exception/CORE.pm

From the error message, we can identify that sends table is crashed and it should be repaired to fix the issue.

Now we will repair the database “eximstats” via backend. The command is given below:

root@myserver [~]# mysqlcheck –repair eximstats

When you execute the above command, it will fix the issue. However I have seen that the database “eximstats” is not repaired. It gives some error. In my case, it gave me below error:

========

root@myserver [~]# mysqlcheck --repair eximstats
eximstats.defers                                   OK
eximstats.failures                                 OK
eximstats.sends
error    : Can't create new tempfile: './eximstats/sends.TMD'
status   : Operation failed
eximstats.smtp                    

========

We could see that database “eximstats” is not repaired and resulted the error “Can’t create new tempfile: ‘./eximstats/sends.TMD’ “. If that happens, then it means it cannot be repaired and will need to be recreated.

Resolution:

If you search the error “Can’t create new tempfile: ‘./eximstats/sends.TMD”, in Google, you will get many solutions and almost all the sites and blog will give the same solution to fix the issue. That solution works as well. I am also pasting a short description of the solution here:

========

mysqlcheck —repair eximstats

When running that command, you will receive something along the lines of:

status : Operation failed

Then run:

mysql
use eximstats;
drop table failures;

Then (important) run:

/usr/local/cpanel/bin/updateeximstats

That should do it. What that last line of code will do is fix the database scheme since you just dropped the failures table. You can also ‘clear’ the other databases to get a clean start. Just know that this will clear all of your current eximstats so if you have important stats you don’t want deleted, don’t clear the rest.

To clear the other stats, run:

mysql
use eximstats;
TRUNCATE TABLE failures;
TRUNCATE TABLE defers;
TRUNCATE TABLE smtp;
exit;

========

The main purpose of making this post is to give a simple and easy solution. If you follow the below resolution, the issue will be fixed in no time.

First go the location “/var/lib/mysql/eximstats”. As we know, all the databases are present in the location “/var/lib/mysql/”. Now list the tables for “eximstats”. Refer the below snippet:

========

root@myserver [~]# ls -la

drwx——   2 mysql mysql      4096 Jan 5 2:25 ./
drwxr-x–x 143 mysql mysql     36864 Jan 4 2:14 ../
-rw-rw—-   1 mysql mysql        65 Apr  5  2016 db.opt
-rw-rw—-   1 mysql mysql      8948 Sep 13 01:55 defers.frm
-rw-rw—-   1 mysql mysql  135880 Jan 5 12:31 defers.MYD
-rw-rw—-   1 mysql mysql   27696 Jan 15 12:31 defers.MYI
-rw-rw—-   1 mysql mysql      8948 Sep 2 01:56 failures.frm
-rw-rw—-   1 mysql mysql  60000 Jan 2 12:31 failures.MYD
-rw-rw—-   1 mysql mysql   8664 Jan 5 12:31 failures.MYI
-rw-rw—-   1 mysql mysql      8992 Sep  01:56 sends.frm
-rw-rw—-   1 mysql mysql  4908 Jan 21 12:32 sends.MYD
-rw-rw—-   1 mysql mysql  27328 Jan 25 12:32 sends.MYI
-rw-rw—-   1 mysql mysql  2162 Jan  7 05:46 sends.TMD
-rw-rw—-   1 mysql mysql      9202 Sep 3 01:57 smtp.frm
-rw-rw—-   1 mysql mysql 55196 Jan 2 12:32 smtp.MYD
-rw-rw—-   1 mysql mysql  6176 Jan 5 12:32 smtp.MYI

========

As we are getting “Can’t create new tempfile: ‘./eximstats/sends.TMD” error, rename the table “sends.TMD” to something else like “sends_old.TMD”. Then repair the eximstats database again.

  • Note: The table which is causing issue, that should be changed to something else.

========
root@myserver [~]# mysqlcheck --repair eximstats
========

You will get a success message and it is now resolved. Now revert the table (i.e. from “sends_old.TMD” to “sends.TMD”).

You can now go to cPanel and run the report for delivery mails. It will work.

Please let me know if you face any issue in this.

Thank you. Have a great day! 🙂

Powered by Facebook Comments

Be the first to comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.