No Backup possible: DDL sql execution error

No Backup possible: DDL sql execution error

by Tobias Stapelfeldt -
Number of replies: 9

Hi,

I tried my very best to get backups working on a new setup 2.0-moodle-site. Everytime I get a "DDL sql execution error" even after backing up a fresh course. I had the same problem during a fresh 2.0 RC2. When I run the database tests I have the same error after the test_temp_tables ran.

Thank you for any further idea. smile

Greetings from Germany

Tobias

Average of ratings: -
In reply to Tobias Stapelfeldt

Re: No Backup possible: DDL sql execution error

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Tobias,

I'd recommend you to:

  1. Enable DEBUG_DEVELOPER in your site.
  2. Run one backup (or the DB tests)
  3. Create on issue in the Tracker with all the details (your DB type & version, the complete error thrown by previous point...)

That way developers will be able to know where to check and under which environment do it, in order to be able to reproduce/fix it ASAP.

TIA and ciao smile

In reply to Eloy Lafuente (stronk7)

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Eloy Lafuente (stronk7)

Re: No Backup possible: DDL sql execution error

by Tobias Stapelfeldt -

Hi Eloy, hi Felicia,

exactly the same situation for me. (Same messages during debug-mode except with my standard database-user)

Thank you for starting an issue.

Greetings

Tobias

In reply to Tobias Stapelfeldt

Re: No Backup possible: DDL sql execution error

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi everyone,

I've commented @ MDL-25545 about the cause of the problems exposed here.

It is, simply, that your database user is lacking permissions to create temporary tables (that are used by any backup & restore operation and also by the database tests).

So all you need is to grant the appropriate permission (CREATE TEMPORARY TABLES for MySQL) to that user, and everything should start working ok.

Hope it helps, ciao smile

Average of ratings: Useful (1)
In reply to Eloy Lafuente (stronk7)

Re: No Backup possible: DDL sql execution error

by Tobias Stapelfeldt -

Hi,

thank you for your instant help. I contacted my administrating host, because I don't have the permission to grant this to my local user of the database. I'll post again if it works.

Greetings

In reply to Tobias Stapelfeldt

Re: No Backup possible: DDL sql execution error

by Tobias Stapelfeldt -
It Works. smile
Average of ratings: Useful (1)
In reply to Tobias Stapelfeldt

Re: No Backup possible: DDL sql execution error

by Daniel Powell -

Hi,


I am not sure if anyone can help but I get this error right at the end of my backup.


However, what is odd, that 1 course on my site backs up fine and this course will not.


Really I cannot see any differences. Also the idea above I thought would count for all courses on the site, and not just one?

Anyone help????


Thanks


Daniel


CREATE TEMPORARY TABLES for MySQL) to that user ?????

In reply to Daniel Powell

Re: No Backup possible: DDL sql execution error

by Colin Fraser -
Picture of Documentation writers Picture of Testers

Daniel, be careful when reading and reviving a discussion that is so old, the conditions that led to the original error may no longer apply in your version of Moodle. It is perhaps better to start a new discussion but with a reference to the older one. That said... 

There has to be some anomaly in the second course causing an error. Is one user enrolled twice? Has someone tried to upload something that does not fit in with the demands of the course, like an unusual file type, not encountered before? Has one file been uploaded that is really large? Is a file corrupted? Lots of issues.

When I have had a backup issue, I go back and take a lot of backups, eliminating that which works, narrowing down to what doesn't. The first being with no user data, and if the error is found, then make a second backup, the top half of the course, if no error, the bottom half of the course, if an error, then one section at a time. More often than not, the error is in the user data, and that is a lot more difficult. Check enrollments, check user uploads, and if nothing stands out, repeat the process with a backup of user data only. If an error occurs there, then I start looking in the database itself, starting with Users. 

This is time consuming, and can be frustrating, and does not always yield a positive result. This can result in me sending the entire course, complete with user data into an archive area that is only accessible by Admins, if the User data is important, or deleting the course entirely, replacing it with an earlier backup. As long as there is a record of the results, usually in a separate spreadsheet, that is deemed sufficient as to remain a "viable record" for the results of that course.            



In reply to Daniel Powell

Re: No Backup possible: DDL sql execution error

by Ken Task -
Picture of Particularly helpful Moodlers

@Daniel ... Is that the error ...

"CREATE TEMPORARY TABLES ... blah, blah"

If it is, could be the DB user you have setup for your Moodle (in config.php file of the code) doesn't have the privileges (permissions) to create temporary tables.

See @Eloy's response in this rather old thread (probably need to start a new one).

And other responses (not to your posting but in this thread) that suggest turning on debugging to see what Moodle says (always a good idea).

Let's see if there is anything of a try at a backup ... got anything that can browse files on your Moodle server?    Use that tool and look in the data directory of your Moodle (path to it found in config.php of the code).

Example is for Linux but should be similar on Windows:

The data directory for the Moodle is in /var/www/moodledata/

In there, a 'temp' directory and in temp a 'backup' directory.

So /var/www/moodledata/temp/backup/

Succesful backups leave a 0 byte log file and the name looks something like this:

18eb07f85bb26c9a6f95f3684972125a.log

A failed backup, leaves a directory, like:

998ef86bf276620010c16f88d75c6624

Look in failed backup directory and see if there is a moodle_backup.xml file or even a file that has 'backup' in front and the extension is .mbz.

*IF* there is a 'backup-blah-blah.mbz' file, the completion of the backup failed at a stage when the code tries to *copy* the .mbz file to filedir.

IF there is no temp files then suspect this might be related to the first ... ie, priv's of the DB user in config.php that doesn't have permissions to create temporary tables.

Check with whatever tool you have to look at the database server and users.   Can't tell ya how to do that specifically.

'spirit of sharing', Ken