MySQL – Out of Resources for mysqldump Solution

MySQL

I'm trying to do a mysqldump on a Windows server and I get the following error message :

mysqldump: Got error: 23: Out of resources when opening file '.\db\sometable.MYD' (Errcode: 24) when using LOCK TABLES

Here's the command I'm running :

mysqldump -u user -p"pass" --lock-tables --default-character-set=latin1 -e --quick databasename > "query.sql"

Restarting the mysql service didn't help.

I always get the message for the same table.

I've tried reducing the table_cache and max_connections variables from 64 to 32 and 30 to 10 respectively but I still get the error only this time for a different table (and from now on the error message is always mentionning the second table).

The same script is running on a dozen other Windows servers having the same database without problems.

All databases have 85 tables.

Best Answer

According to here - "OS error code 24: Too many open files" which lines up with the more general error 23 "Out of resources".

So it seems as though you are running out of file handles. This is usually server-end setting/problem, either in MySQL, or in the OS itself.

Perhaps check/adjust the --open-files-limit setting in MySQL itself and see if that helps.

Also, perhaps try running the dump, while no one else is using the DB, with the --single-transaction setting instead of --Lock-File, as several people suggest this will work one table at a time instead of opening them all at once (therefore using less file handles).

Beyond that you'll probably have to find a root cause as to why this particular server is running out of resources. Which would probably involve troubleshooting by disabling as many services/processes as possible and see if the dump goes through. Then figure out from there who the culprit is that's eating too many resources and perhaps not freeing them correctly.