Dummy's guide to backing up

Re: Dummy's guide to backing up

by Mark Cornwell -
Number of replies: 0

Hi again. Looks like there isn't a dummies guide, but whilst the books arrive from Amazon... I managed to find some of the snippets from the documentation and put it together with the info from William Rice's book.

Here it is for anyone that is looking for it.

William has backups under: administration>configuration>backup

I'm on 1.7 and it is now under administration>courses>backups. The screen has changed a bit from the one he showed but good enough to get going with.

One bit I could not get to work was the "save to" field, which would not allow anything I put there - apparently none of my attempts was valid. I left that for another day!

William suggested that it created backups in one place, but I found them scattered through the course in "backup" directories (probably connected to not getting "save to" working). But it did allow me to restore them as new courses or overwrite existing courses. Both of which are handy.

In the documentation I found under "upgrade" the following:

http://docs.moodle.org/en/Upgrading_Moodle#Backup_important_data

That was useful, but has Unix stuff which I wasn't sure of. However, I found mysqldump in C:\Program Files\xampp\mysql\bin on my machine and guessed that this might be something I could run from a Windows command prompt. I was able to substitute my username and database name and get a backup via the command prompt.

So I can now backup individual courses (using a cron tool http://docs.moodle.org/en/Cron to trigger the backup, and going for the moodle-cron-for-windows) and, of course, the data files themselves as a set, and the database.

I can restore the files and the courses... but I have not yet located anything that tells me how to restore the database for sure (see below).

Were I to have a crash, would restoring the files and then all of the individual courses restore the database? Or do I need to do more than that? I would assume that a database restore may be faster/better than restoring individual courses.

I *think* I've found the doc for restore under FAQ http://docs.moodle.org/en/Backup_FAQ which has

mysql -p new_database < moodlesqlfile.sql

which I take to be telling me to pipe the backup file into mysql and create a database called new_database - but I'm not sure if I literally exchange "new_database" for my database name (for example "moodle_db") or what. I am not sure where this is documented - probably off on MySQL's site.

It seems the information is out there... just not in one place and not in a way that you can quickly understand if PHP/MySQL and Unix are not your best friends!

I then realised that the phpMyAdmin that William mentions in the book was something I used on the initial setup of Moodle via xampp on localhost. Sure enough I found it by going to //localhost and managed to do an export of the database very much more easily than I had via the command line. Presumably I would import to restore (William showed using SQL to run a command from a file but that option isn't in the version I have installed, so I guess Import is the new equivalent).

At least I am making progress :D

If anyone can offer suggestions on a) the "save as" feature and b) my question over if I just restore the files and then the database... or restore the files and then restore each course... which should I do... which is quicker that would be much appreciated.

Thanks,

         Mark