Course restore fails with database write error - mdl_assisubm_assusegroatt_uix

Course restore fails with database write error - mdl_assisubm_assusegroatt_uix

by Vickie Anderson -
Number of replies: 2

I have created a new Moodle server (3.0) and have backed up courses from my old 3.0 server and am restoring them on the new server for a pilot project. I have been successful in restoring 30+ courses, but I have about 8 that are failing.

Any assistance you can provide is appreciated.

Here is the error message that I receive:

Debug info: Duplicate entry '499-148-0-0' for key 'mdl_assisubm_assusegroatt_uix'
INSERT INTO mdl_assign_submission (assignment,userid,timecreated,timemodified,status,groupid,latest) VALUES (?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?),(?,?,?,?,?,?,?)
[array (
0 => 499,

..... (skipped all the lines in between)

Error code: dmlwriteexception
Stack trace:
  • line 446 of /lib/dml/moodle_database.php: dml_write_exception thrown
  • line 1328 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 1295 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_chunk()
  • line 340 of /mod/assign/backup/moodle2/restore_assign_stepslib.php: call to mysqli_native_moodle_database->insert_records()
  • line 351 of /mod/assign/backup/moodle2/restore_assign_stepslib.php: call to restore_assign_activity_structure_step->set_latest_submission_field()
  • line 410 of /backup/util/plan/restore_structure_step.class.php: call to restore_assign_activity_structure_step->after_execute()
  • line 113 of /backup/util/plan/restore_structure_step.class.php: call to restore_structure_step->launch_after_execute_methods()
  • line 181 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
  • line 198 of /backup/moodle2/restore_activity_task.class.php: call to base_task->execute()
  • line 177 of /backup/util/plan/base_plan.class.php: call to restore_activity_task->execute()
  • line 167 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
  • line 333 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
  • line 224 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
  • line 111 of /backup/restore.php: call to restore_ui->execute()

Average of ratings: -
In reply to Vickie Anderson

Re: Course restore fails with database write error - mdl_assisubm_assusegroatt_uix

by Joseph Mary -

I am running Moodle 3.4 (Build: 20171113)

I have a similar problem...

I am trying to restore a backup and getting this error.

Error writing to database

More information about this error


Debug info: Duplicate entry '10-98' for key 'mdl_forusubs_usefor_uix'

INSERT INTO mdl_forum_subscriptions (userid,forum) VALUES(?,?)

[array (

0 => '10',

1 => 98,

)]

Error code: dmlwriteexception


Stack trace:

  • line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown
  • line 1282 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 1328 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
  • line 171 of /mod/forum/backup/moodle2/restore_forum_stepslib.php: call to mysqli_native_moodle_database->insert_record()
  • line 137 of /backup/util/plan/restore_structure_step.class.php: call to restore_forum_activity_structure_step->process_forum_subscription()
  • line 112 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()
  • line 178 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()
  • line 100 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk()
  • line 148 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk()
  • line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk()
  • line 190 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()
  • line 278 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()
  • line ? of unknownfile: call to progressive_parser->end_tag()
  • line 179 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()
  • line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()
  • line 110 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()
  • line 181 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
  • line 210 of /backup/moodle2/restore_activity_task.class.php: call to base_task->execute()
  • line 178 of /backup/util/plan/base_plan.class.php: call to restore_activity_task->execute()
  • line 167 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
  • line 339 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
  • line 224 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
  • line 135 of /backup/restore.php: call to restore_ui->execute()

In reply to Joseph Mary

Re: Course restore fails with database write error - mdl_assisubm_assusegroatt_uix

by Vickie Anderson -

What worked for me was backing up the course again with no user data. Doing this allowed me to restore the course with no issues.