The initial problem was a stall in the backup process for a course with a large amount of activities. (MDL-34388,http://tracker.moodle.org/browse/MDL-34388). The backup process for all other courses worked fine.
I then tried to have a go at fixing the backup stall by making some changes in this file (line 159.) /backup/util/dbops/backup_controller_dbops.class.php which I had read about
This didn't fix the problem, so I restored the original /backup/util/dbops/backup_controller_dbops.class.php file (which I had copied).
This precipitated my second problem, which appears to be that I now don't have permission to write a temp file in the database. When I try to backup any course now, I get this problem;
Table "backup_ids_temp" already exists
Stack trace:
line 492 of /lib/ddl/database_manager.php: ddl_exception thrown
line 159 of /backup/util/dbops/backup_controller_dbops.class.php: call to database_manager->create_temp_table()
line 106 of /backup/util/dbops/backup_controller_dbops.class.php: call to backup_controller_dbops::create_temptable_from_real_table()
line 39 of /backup/moodle2/backup_stepslib.php: call to backup_controller_dbops::create_backup_ids_temp_table()
line 34 of /backup/util/plan/backup_execution_step.class.php: call to create_and_clean_temp_stuff->define_execution()
line 153 of /backup/util/plan/base_task.class.php: call to backup_execution_step->execute()
line 148 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
line 106 of /backup/util/plan/backup_plan.class.php: call to base_plan->execute()
line 304 of /backup/controller/backup_controller.class.php: call to backup_plan->execute()
line 111 of /backup/util/ui/backup_ui.class.php: call to backup_controller->execute_plan()
line 89 of /backup/backup.php: call to backup_ui->execute()
There is a clear reference to line 159 which I had tried to fiddle with.
Here is the backup error log...
[23-Oct-2012 09:17:40] instantiating backup controller 88a8288453ff6678411114e08db08f8e
[23-Oct-2012 09:17:40] setting controller status to 100
[23-Oct-2012 09:17:40] loading controller plan
[23-Oct-2012 09:17:40] setting controller status to 300
[23-Oct-2012 09:17:40] applying plan defaults
[23-Oct-2012 09:17:40] setting controller status to 400
[23-Oct-2012 09:17:40] checking plan security
[23-Oct-2012 09:17:40] setting controller status to 500
[23-Oct-2012 09:17:40] checking plan security
[23-Oct-2012 09:17:40] checking plan security
[23-Oct-2012 09:17:40] checking plan security
[23-Oct-2012 09:17:40] saving controller to db
[23-Oct-2012 09:17:40] calculating controller checksum 856643f47aba7dae5b2d7293143442c4
[23-Oct-2012 09:17:52] loading controller from db
[23-Oct-2012 09:17:52] checking plan security
[23-Oct-2012 09:17:52] checking plan security
[23-Oct-2012 09:17:52] checking plan security
[23-Oct-2012 09:17:52] saving controller to db
[23-Oct-2012 09:17:52] calculating controller checksum 856643f47aba7dae5b2d7293143442c4
[23-Oct-2012 09:18:00] loading controller from db
[23-Oct-2012 09:18:00] checking plan security
[23-Oct-2012 09:18:00] checking plan security
[23-Oct-2012 09:18:00] checking plan security
[23-Oct-2012 09:18:00] saving controller to db
[23-Oct-2012 09:18:00] calculating controller checksum 856643f47aba7dae5b2d7293143442c4
[23-Oct-2012 09:18:07] loading controller from db
[23-Oct-2012 09:18:07] checking plan security
[23-Oct-2012 09:18:07] checking plan security
[23-Oct-2012 09:18:07] setting controller status to 700
[23-Oct-2012 09:18:07] saving controller to db
[23-Oct-2012 09:18:07] calculating controller checksum b4f78fd53c9a9265301aae8eb775db0c
[23-Oct-2012 09:18:07] loading controller from db
[23-Oct-2012 09:18:07] setting controller status to 800
[23-Oct-2012 09:18:09] Default exception handler: Table "backup_ids_temp" already exists Debug:
* line 492 of /lib/ddl/database_manager.php: ddl_exception thrown
* line 159 of /backup/util/dbops/backup_controller_dbops.class.php: call to database_manager->create_temp_table()
* line 106 of /backup/util/dbops/backup_controller_dbops.class.php: call to backup_controller_dbops::create_temptable_from_real_table()
* line 39 of /backup/moodle2/backup_stepslib.php: call to backup_controller_dbops::create_backup_ids_temp_table()
* line 34 of /backup/util/plan/backup_execution_step.class.php: call to create_and_clean_temp_stuff->define_execution()
* line 153 of /backup/util/plan/base_task.class.php: call to backup_execution_step->execute()
* line 148 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
* line 106 of /backup/util/plan/backup_plan.class.php: call to base_plan->execute()
* line 304 of /backup/controller/backup_controller.class.php: call to backup_plan->execute()
* line 111 of /backup/util/ui/backup_ui.class.php: call to backup_controller->execute_plan()
* line 89 of /backup/backup.php: call to backup_ui->execute()
[Further observation, there also appears to be some minor formatting problems in my other courses now (a problem related to my custom CSS?). Also, I created a clone of my site using c Panel, but when I open the clone site, all formatting has been removed. Only text and links seem to be there on the front page. Also, when I try to log in I get a message that the login file doesn't exist, even though it does. I have checked that permissions on the file are 644. The backup process seems to work fine in the old clone versions]
This moodle doc seems to be related to a fix, but goes to another level of complexity which I hope to avoid.