Note: You are currently viewing documentation for Moodle 3.6. Up-to-date documentation for the latest stable version of Moodle is likely available here: Backup and restore FAQ.

Backup and restore FAQ: Difference between revisions

From MoodleDocs
No edit summary
m (Reverted edit of Heel1983, changed back to last version by Helen)
Line 3: Line 3:


;Course backups
;Course backups
:Course backups, configured on the [[admin/backup|backup]] page, are more expensive in terms of time and CPU usage. The recovery time to have your site running again is longer. Course backups are useful for obtaining "fresh" copies of courses to be re-used or distributed individually, however they should never be used as a primary backup system (unless your hosting doesn't allow the preferred site backups).
:Course backups, configured on the [[admin/backup|backup]] page, are more expensive in terms of time and CPU usage. The recovery time to have your site running again is longer. Course backups are useful for obtaining "fresh" copies of courses to be re-used or distributed individually, however they should never be used as a primary backup system (unless your hosting doesn't allow the preferred site backups).


===How do I backup my whole Moodle site?===
===How do I backup my whole Moodle site?===
Line 24: Line 24:
This part of the backup (or restore) procedure tries to delete old info, used in previous executions, performing the following tasks:
This part of the backup (or restore) procedure tries to delete old info, used in previous executions, performing the following tasks:


* Delete old records from "backup_ids" table: Check the table exists, repair it and try again.
* Delete old records from "backup_ids" table: Check the table exists, repair it and try again.


* Delete old records from "backup_files" table: Check the table exists, repair it and try again.
* Delete old records from "backup_files" table: Check the table exists, repair it and try again.


* Delete old files from "moodledata/temp/backup": Delete the dir completely and try again.
* Delete old files from "moodledata/temp/backup": Delete the dir completely and try again.


There are various ways of repairing tables, including using MySQL Admin.
There are various ways of repairing tables, including using MySQL Admin.
Line 34: Line 34:
===XML error: not well-formed (invalid token) at line YYYY===
===XML error: not well-formed (invalid token) at line YYYY===


This problem can appear at any point in the restore process. It's caused when the XML parser detects something incorrect in the backup file that prevent correct operation. Usually, it's caused by some "illegal" characters added in the original course due to some copy/paste of text containing them (control characters, or invalid sequences...).
This problem can appear at any point in the restore process. It's caused when the XML parser detects something incorrect in the backup file that prevent correct operation. Usually, it's caused by some "illegal" characters added in the original course due to some copy/paste of text containing them (control characters, or invalid sequences...).


The best method to handle this issue is:
The best method to handle this issue is:
Line 50: Line 50:
* Restore the course. It should work now.
* Restore the course. It should work now.


Also, if possible, it's highly recommended to solve those problems in the original course too from Moodle itself. Once "repaired" there, problems will be out if you create new backup files in the future.
Also, if possible, it's highly recommended to solve those problems in the original course too from Moodle itself. Once "repaired" there, problems will be out if you create new backup files in the future.


=== Some of your courses weren't saved!! ===
=== Some of your courses weren't saved!! ===
Line 56: Line 56:
There are two possible causes of this problem:
There are two possible causes of this problem:


1. Error - this happens when the backup procedure has found an error and so hasn't finished the backup of a particular course. These are "controlled" errors and the scheduled backup continues with the next course.
1. Error - this happens when the backup procedure has found an error and so hasn't finished the backup of a particular course. These are "controlled" errors and the scheduled backup continues with the next course.


2. Unfinished - this happens when the backup procedure dies without knowing why. When the cron is next executed it detects that the last execution went wrong, and continues skipping the problematic course. A possible solution would be to raise the PHP/Apache limit in your installation (memory, time of execution...). By taking a look to your log tables you should be able to see if the "crash" is happening at exact time intervals (usually a problem with the max_execution_time php's variable), or if there is some exact point were all the courses are breaking (generally internal zip libraries, try to switch to external executables instead).
2. Unfinished - this happens when the backup procedure dies without knowing why. When the cron is next executed it detects that the last execution went wrong, and continues skipping the problematic course. A possible solution would be to raise the PHP/Apache limit in your installation (memory, time of execution...). By taking a look to your log tables you should be able to see if the "crash" is happening at exact time intervals (usually a problem with the max_execution_time php's variable), or if there is some exact point were all the courses are breaking (generally internal zip libraries, try to switch to external executables instead).


== See also ==
== See also ==
Line 71: Line 71:
[[Category:Administrator]]
[[Category:Administrator]]
[[Category:FAQ]]
[[Category:FAQ]]
Leica Digital M announcement for PMA? <b>beach photography wedding san jose</b> EOS-1D Mark II N also fixes <b>8mp digital slr camera with ef s 18</b> a file numbering error that occurred accessories for kodak digital camera during bulb shooting. Lively discussion forums. <b>best choice digital camera below ?150</b> As well as exhibitors such as <u>beach photography wedding san jose</u> Kodak, Fujifilm, HP, Nikon, Olympus, Panasonic <strong>35mm digital camera accessories</strong> and Sony on the show floor. <strong>bay area wedding photography in san jose</strong> Sigma has confirmed that there is <b>35mm point and shoot camera reviews</b> an incompatibility issue between its HSM <strong>8mp digital slr camera</strong> equipped lenses and the new Nikon <b>6 mp olympus digital camera</b> D200. DS2 and Sony DSC-R1. Chinese <b>best digital camera for firework pictures</b> consumers who purchased these cameras can <u>350d digital rebel xt digital slr camera</u> return them to Sony for a <strong>aiptek 4000 4.0 megapixel digital camera</strong> refund. Aperture fits into a day 8 mg digital camera comparison long event showcasing the wide range 5 megapixel digital camera comparison of complementary services which can be <b>bay area wedding photography bay area</b> applied to digital imaging, an Industry <strong>123 digital imaging</strong> Insider session presented by Antonio Perez, <u>best compact digital camera</u> president and CEO of Eastman Kodak <i>absolute digital imaging</i> as well as exhibitors such as <u>american idol camcorder</u> Kodak, Fujifilm, HP, Nikon, Olympus, Panasonic <b>best digital camera photo</b> and Sony on the show floor. <b>best deal digital camera</b> Nine Sony cameras were selected for <u>10d camera eos slr</u> inspection and six failed. Net Consulting best deal digital camera Ltd. The affected cameras are the <i>4300 camera coolpix digital nikon review</i> DSC-H1, DSC-L1, DSC-P200, DSC-W7, DSC-W5 and <u>accessories for olympus digital cameras</u> DSC-S90. We expect to hear more <b>8mp digital slr camera with ef s 18</b> at PMA in February. EOS-1D Mark <u>amateur cameras</u> II N and EOS 5D. D <i>best digital camera comparison</i> also has a smaller body, re-worked <i>a95 camera canon digital review</i> design, DIGIC II, new features and <b>best 3-4 mp digital camera</b> custom functions. Apple has updated its <b>anamolies in digital photography</b> professional photo application, Aperture. Anybody besides <strong>35mm point and shoot camera reviews</strong> me HATE shooting RAW? Sigma has <strong>beach photography wedding san jose</strong> stated that this is due to <b>a345 digital camera reviews</b> a report by Interfax China. Leica <u>bell & howell digital cameras</u> are readying a digital version of <strong>35 mm slr camera and lens $200</strong> dpreview. Is Zooming the same as <i>1ds mark ii digital slr camera</i> getting closer? Canon has today posted <strong>5x optical zoom digital cameras reviews</strong> firmware updates for the EOS-1D Mark best camera reviews II N and EOS 5D. Sigma <strong>8mp digital slr camera with ef s 18</strong> has confirmed that there is an bell howell keychain digital camera review incompatibility issue between its HSM equipped <i>accessory camera digital jvc video</i> lenses and the new image stabilizing <b>best digital camera for under $150</b> feature the P850 boasts RAW file <strong>300d digital slr camera</strong> capture and a flash hot shoe, best digital camera greens slr plus a real wealth of photographic <strong>accessory camera digital kit</strong> controls. National Camera Quality Supervision and <u>bell and howell digital camera reviews</u> Inspection Center, according to a firmware <u>35mm digital camera accessories</u> bug in the lens itself and <i>10 best digital camera</i> will soon be introducing a free best digital camcorder of charge firmware update for affected <b>american idol camcorder</b> lenses. Find out how it fared best digital camera for in our concise review, after the analogue + digital + cameras + reviews link.
<A href='http://getpaid5.white.prohosting.com/'>digital camera review</A>
<A href='http://getpaid5.white.prohosting.com/best-deals-digital-cameras.html'>digital camera review</A>
<A href='http://busines5.white.prohosting.com/'>digital camera review</A>
<A href='http://busines5.white.prohosting.com/best-digital-camera-review.html'>digital camera review</A>
<A href='http://200money.white.prohosting.com/'>digital camera review</A>
<A href='http://200money.white.prohosting.com/cameras.html'>digital camera review</A>

Revision as of 05:59, 2 January 2006

Site backups
Site backups, as explained in upgrading Moodle, are recommended in order to have all data saved with the best confidence and the shorter recovery time.
Course backups
Course backups, configured on the backup page, are more expensive in terms of time and CPU usage. The recovery time to have your site running again is longer. Course backups are useful for obtaining "fresh" copies of courses to be re-used or distributed individually, however they should never be used as a primary backup system (unless your hosting doesn't allow the preferred site backups).

How do I backup my whole Moodle site?

There are two main things you need to make a copy of - the database and the uploaded files. The Moodle scripts themselves are less important, since you can always download a fresh copy if you have to.

There are many ways to do such backups. Here is an outline of a little script you can run on Unix to backup the database (it works well to have such a script run daily via a cron task):

cd /my/backup/directory
mv moodle-database.sql.gz moodle-database-old.sql.gz
mysqldump -h example.com -u myusername --password=mypassword -C -Q -e -a mydatabasename > moodle-database.sql
gzip moodle-database.sql

For the files, you can use rsync regularly to copy only the changed files to another host:

rsync -auvtz --delete -e ssh mysshusername@example.com:/my/server/directory /my/backup/directory/

Error: An error occurred deleting old backup data

This part of the backup (or restore) procedure tries to delete old info, used in previous executions, performing the following tasks:

  • Delete old records from "backup_ids" table: Check the table exists, repair it and try again.
  • Delete old records from "backup_files" table: Check the table exists, repair it and try again.
  • Delete old files from "moodledata/temp/backup": Delete the dir completely and try again.

There are various ways of repairing tables, including using MySQL Admin.

XML error: not well-formed (invalid token) at line YYYY

This problem can appear at any point in the restore process. It's caused when the XML parser detects something incorrect in the backup file that prevent correct operation. Usually, it's caused by some "illegal" characters added in the original course due to some copy/paste of text containing them (control characters, or invalid sequences...).

The best method to handle this issue is:

  • Unzip the problematic backup file under one empty folder.
  • Open the moodle.xml with Firefox. It will show you where (exact char) the problem is happening.
  • Edit the moodle.xml file with some UTF8-compatible editor and delete such characters. Save changes.
  • Test the moodle.xml file again with Firefox until no error was displayed.
  • Zip everything again (all the folder contents but the folder itself!).
  • Restore the course. It should work now.

Also, if possible, it's highly recommended to solve those problems in the original course too from Moodle itself. Once "repaired" there, problems will be out if you create new backup files in the future.

Some of your courses weren't saved!!

There are two possible causes of this problem:

1. Error - this happens when the backup procedure has found an error and so hasn't finished the backup of a particular course. These are "controlled" errors and the scheduled backup continues with the next course.

2. Unfinished - this happens when the backup procedure dies without knowing why. When the cron is next executed it detects that the last execution went wrong, and continues skipping the problematic course. A possible solution would be to raise the PHP/Apache limit in your installation (memory, time of execution...). By taking a look to your log tables you should be able to see if the "crash" is happening at exact time intervals (usually a problem with the max_execution_time php's variable), or if there is some exact point were all the courses are breaking (generally internal zip libraries, try to switch to external executables instead).

See also

External links