How to minimize the question bank when doing backup/restore

Jump to: navigation, search

Note: You are currently viewing documentation for Moodle 3.3. Up-to-date documentation for the latest stable version of Moodle is probably available here: How to minimize the question bank when doing backup/restore.

When you back up and restore a course or a quiz, often a very large question bank is backed up which includes many questions not being used in the course or quiz. This can be a problem when the question bank on a site gets very large (over 1000 questions or over 500mb). At this point, backup and restore may fail due to timeouts or other technical reasons. Sharing courses on the Hub is also difficult because large question banks of unrelated questions are included which make sharing backup files difficult and confusing to teachers receiving the question bank.

Originally, the question bank in a course and the upper level categories of questions has always been included in a backup. In 2007, a Tracker issue (MDL-12403) was made to allow teachers and administrators to limit the questions included in a backup to just the ones needed. Discussion on that this issue showed that a solution was difficult and in 2013, a checkbox was added to the Backup procedure to completely remove the question bank in a backup file. Thus from Moodle 2.7, it was possible to do an all-or-nothing inclusion or exclusion of the question bank. When the checkbox to exclude the question bank is checked, all quizzes are also removed from the backup.

This did not solve the original issue so a separate Tracker issue was made concerning how to minimize or select the questions included in a backup (MDL-41924). As of Moodle 2.9, this issue is still open. As teachers and admins need to share questions and share courses which often include quizzes (one of the most popular activities in Moodle), it is still possible to minimize the questions, though doing it manually is complicated. The following workaround was successfully done in Moodle 2.9.1, and the resulting course backup file was restored on a Moodle 2.8.5 site.

This workaround strategy is based on the design of the question bank which only includes questions in a backup that are in the same category or a higher level category. Thus System Level questions are included in every backup on the site. Note that Moodle uses the word "category" in two ways which can be confusing. A "category" can refer to a group of courses (Course Category) or a group of questions (question bank category). In this section, we usually use "category" to mean a group of questions in the question bank. These categories are also called "contexts".

Workaround to Minimize Questions in a Course Backup

  1. Move all questions from System Level and other upper level Categories in your question bank to lower category levels--down to course level categories. (this makes it difficult to view and share, but is necessary).
  2. Move the course (or a copy of the course) to a temporary Course Category somewhere on your site where there are no other courses.
  3. Make a backup of your course and restore this backup in the same Course Category. (Moodle will automatically push all upper level category questions into course level categories--you will see this happen on the screen).
  4. Go into the newly restored course and open the Question Bank. You will see all questions are at the course level.
  5. Prune (delete) all unneeded questions in your newly restored course. Do not worry about deleting here, because you are only deleting course level copies of the questions. The original questions on your site are not affected.
  6. As you delete groups of questions, Moodle will list and confirm the questions you wish to delete. If you mistakenly try to delete a question that is being used in your course, Moodle will mark that one with an asterisk. Then cancel the deletion, and try selecting again. Note those questions and cancel the deletion and choose only unneeded questions. (in the case of thousands of questions, this deletion process can take a long time).
  7. After you have minimized the questions manually by deletion at these course level categories, you can now make a another backup file and when you restore it, only the remaining questions you selected will be included.

In addition, you can encourage Moodle HQ to tackle this issue by voting, watching, and commenting in these two tracker issues: MDL-41924 and MDL-12403.