Last week about 10:30 in the am, I decided to give my troublesome moodle DB upgrade another shot. I have a test environment where I restore the DB to and then move moodle code into and out of. Recently, I accidentally deleted the config.php file from the root. I copied the one from the production instance into the test instance.
I updated the wwwroot and dataroot values BUT, somehow, terrible, MISSED THE dbname property. It still had the production db listed.
OOPS
I started the upgrade about 10:30, fortunately, I also backed up the production DB and restored it to the test instance.
Some time after this my colleagues emailed me and asked if I knew what was going on, why the live db was upgrading. OYE. blood pressure from 80/120 to 120/160.........
It is hard to think clearly when the BP is high. Take deep breaths, ask your colleague to come down and help you think through what is going on.
After a bit more fusing around and actually walking away from the problem for a bit, I was able to spot my problem in the config file. Once I knew what I had done, I was able to restore the DB from 10:30. After restoring the DB, I messaged me customers and said everything was fine. BUT, in reality, we lost about 3 hrs of data that day. After everything calmed back down, I was able to look in the site logs and see a skip of over 3 hrs. No harm no foul. If someone complained to us about losing something that they did, like a quiz attempt or uploaded file, then I would have set about trying to recover data from my corrupted old live DB.
That did not happen, so I say again, no harm no foul.
Moral of the story? Pay attention to the $CFG->dbname value in your config.php file PRIOR to starting a DB upgrade.

For me, such things are incomprehensible, because I have never done programming. I like to use proven native applications the most. It was enough for me to go to the website https://grapeup.com/contact/ and get all possible answers to my questions.
ReplyDelete