The course backup and restore functionality built into Moodle is really most suitable if you want to specifically back up and restore (or share or duplicate) individual courses.
IF worst came to worst, and an admin lost an entire site due to a bad upgrade or anything else, how would the restore process happen?
Part of the answer (backing up) is on http://moodle.org/doc/?frame=upgrade.html
To backup the WHOLE SITE, simply copy the whole site directory and data directory to a different directory name.
To backup the mysql database, simply run
mysqldump moodle > moodle-backup-2002-10-26.sql
BUT I'm still looking for the second part of the answer (restoring).
Obviously, one can just copy back the renamed site and data directories.
HERE'S THE REAL QUESTION: How does one restore the moodle-backup.sql file that was created upon backup?
- How would an admin restore a backup database over the current (bad) database? This might be in the case of a bad upgrade.
- Is it the same process to restore to a machine with no database? This might be in the case of a machine/hardware failure.
There is another (?) backup routine here
http://www.phpfreaks.com/script/view/11.php
recommended by Jan Dierckx on this thread. I got it to work in manual mode, but alas the dumps created by the cron every night have a byte size of one byte!
Also as mentioned here I have found that the dumped database is so large that it is difficult to restore it. Things time out. And to lengthen the time out is not so easy (for me anyway). I tried changing apache and php settings but failed. It seems that there are a lot of people that are having difficulty restoring very large backup files. I guess it can take a couple of hours so it will run foul of every timeout setting there is (apache?, mysql?, php?).
One way of doing it is by restoring the dump in parts.
There is also a program called megadump or something but I never got it working.
Timothy
After your mysql dattabase has been dumped to file, you can use:
mysql -u root -p < mysqldumpfile
I use a script created by my friend to backup my databases. I then use another simple script to change the name to include the date, I have included the zip of all the files.
In the zip there are 3 scripts, backup.sh, backupmv.sh, mysqlqdump,sh.
Using the backup.sh script and cron I can have a backup of the database every night. This is my crontab:
0 0 * * * /bin/bash /mysqlbackup/backup.sh
When this script runs, it backs up the database into the same folder, then runs the backupmv.sh to rename it and add the date. All works well so far, however I have never tried to restore and I use Navicat to do backups as well, just in case.
Good luck
Rusty