Error writing to database when importing from one course to another or performing backups (v2.9.1)

Error writing to database when importing from one course to another or performing backups (v2.9.1)

by Dave Perry -
Number of replies: 3
Picture of Testers

One of my colleagues has had issues importing from or backing up certain courses. With debugging mode on, I have compared a working backup/import with a one from this page that gives us the

The table concerned is mdl_backup_controller, and the LONGTEXT field in the INSERT statement ('operation') has two massively different values - on the working one, the operation value was about 143k characters. On the poorly one, it was 10x that!

1) Is a backup initialisation INSERT meant to go as high as 1.5mb? The error we get in the logs is 'MySQL Server has gone away' for this attempt.

2) Is there I know that LONGTEXT can be up to 4gb, but I can't figure out from our my.ini or PHP.ini what the maximum connection size is allowed as. Do we have to specifically allow bigger values? The other fields' values for these INSERT statements are next to nothing.

Average of ratings: -
In reply to Dave Perry

Re: Error writing to database when importing from one course to another or performing backups (v2.9.1)

by Ken Task -
Picture of Particularly helpful Moodlers

The error ... server gone away ... is sometimes the result of max_packets_allowed setting to be too low to handle the date Moodle is trying to import in a restore process.

Check out the setting for max_packets_allowed in your MySQL server.

https://dev.mysql.com/doc/refman/5.1/en/packet-too-large.html

'spirit of sharing', Ken

Average of ratings: Useful (2)
In reply to Ken Task

Re: Error writing to database when importing from one course to another or performing backups (v2.9.1)

by Dave Perry -
Picture of Testers

Bingo, set it to 8mb, restarted the service and now we're in business. Thanks

In reply to Dave Perry

Re: Error writing to database when importing from one course to another or performing backups (v2.9.1)

by Ken Task -
Picture of Particularly helpful Moodlers

Welcome!  Glad that was the solution ... and thanks for the +1 (useful rating).

'spirit of sharing', Ken