Quantcast
Channel: Backup and restore
Viewing all articles
Browse latest Browse all 6815

Course Restore fails with Duplicate Entry error

$
0
0
by Quintin Seegers.  

Moodle v3.11.18

We are in the process of moving from a Moodle Partner hosting to self-hosting our Moodle site. We don't have server access on the Partner hosted site, only UI access. We are manually migrating our courses via manual backup/restore from the Moodle Partner site (old site) to our self-hosted site (new site).  The backups include enrolments/user data as we need to migrate full course participation history.

When restoring some of the courses, we get the following error:

Debug info: Duplicate entry '0-lmsadmin' for key 'mdl_user.mdl_user_mneuse_uix'
INSERT INTO mdl_user (username,idnumber,email,phone1,phone2,institution,department,address,city,country,lastip,picture,description,descriptionformat,imagealt,auth,
firstnamephonetic,lastnamephonetic,middlename,alternatename,firstname,lastname,confirmed,policyagreed,deleted,lang,theme,timezone,firstaccess,
lastaccess,lastlogin,currentlogin,mailformat,maildigest,maildisplay,autosubscribe,trackforums,timecreated,timemodified,trustbitmask,password) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
[array (
0 => 'lmsadmin',
1 => '',
2 => 'lmsadmin@[REDACTED]',
3 => '',
4 => '',
5 => '',
6 => '',
7 => '',
8 => '',
9 => 'AU',
10 => '52.64.250.116',
11 => 0,
12 => '',
13 => '1',
14 => '',
15 => 'manual',
16 => '',
17 => '',
18 => '',
19 => '',
20 => 'LMS',
21 => 'Administrator',
22 => '1',
23 => 0,
24 => '0',
25 => 'en',
26 => '',
27 => '99',
28 => '1435894661',
29 => '1588740174',
30 => '1588720824',
31 => '1588738047',
32 => '1',
33 => '1',
34 => '0',
35 => '1',
36 => '1',
37 => '1435894571',
38 => '1498525335',
39 => '0',
40 => 'restored',
)]
Error code: dmlwriteexception

Stack trace:
  • line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown
  • line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
  • line 1357 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
  • line 1403 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
  • line 1271 of /backup/util/dbops/restore_dbops.class.php: call to mysqli_native_moodle_database->insert_record()
  • line 1145 of /backup/moodle2/restore_stepslib.php: call to restore_dbops::create_included_users()
  • line 34 of /backup/util/plan/restore_execution_step.class.php: call to restore_create_included_users->define_execution()
  • line 181 of /backup/util/plan/base_task.class.php: call to restore_execution_step->execute()
  • line 191 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
  • line 168 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
  • line 408 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
  • line 219 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
  • line 143 of /backup/restore.php: call to restore_ui->execute()
The user 'lmsAdmin' already exists as a user with the same email address. We also have the option "Allow admin conflict resolution" enabled.

When I click on Continue, the following error comes up:



This is only happening on the restore of some of our courses and not all of them.

We had a similar issue some time ago when we merged two moodle sites into a single sight. Then, the Moodle partner explained the issue was with the site ID's being the same and that they made a change to the Moodle code to treat all backups being restores as backups with a different Site ID. They didn't then and won't now, share what the change was the made.

Any suggestions on how we can resolve this? Manually changing the contents in the backup file isn't practical as we're looking at 100+ courses to restore manually.


Viewing all articles
Browse latest Browse all 6815

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>