Error reading from database when I try to reset a course

Error reading from database when I try to reset a course

Bethany B -
回帖数:15

Hi!  ​I am working through an upgrade that took me from Moodle 3.10 to Moodle 4.4, so I have all sorts of questions. My site is hosted with SiteGround.  I have Moodle 4.4.1+ (Build: 20240726) in maintenance mode until Monday while I work out the hiccups.  My PHP is PHP Version 8.2.21.

When I go to a course as the admin > More dropdown > Reset > Course reuse > select all the boxes I need to reset the course > click Reset Course button > I receive "Error reading from database" and the course does not reset.  I have copied the debug info from the error page below.  Where do I start to figure this error out?  Thank you in advance!

Sincerely,

Bethany

Debug info: Unknown column 'timelimit' in 'field list'
SELECT id, groupid, userid, duedate, sortorder, timelimit FROM mdlvo_assign_overrides WHERE assignid = ?
[array (
0 => '816',
)]
Error code: dmlreadexception×Dismiss this notification

Stack trace:
line 494 of /lib/dml/moodle_database.php: dml_read_exception thrown
line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
line 1398 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
line 1513 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
line 1464 of /lib/dml/moodle_database.php: call to moodle_database->get_records_select()
line 166 of /mod/assign/lib.php: call to moodle_database->get_records()
line 118 of /mod/assign/lib.php: call to assign_prepare_update_events()
line 1126 of /course/lib.php: call to assign_refresh_events()
line 1108 of /course/lib.php: call to course_module_calendar_event_update_process()
line 5297 of /lib/moodlelib.php: call to course_module_bulk_update_calendar_events()
line 78 of /course/reset.php: call to reset_course_userdata()

回复Bethany B

Re: Error reading from database when I try to reset a course

Ken Task -
Particularly helpful Moodlers的头像

Did you 'hyperjump' upgrades? Does SG offer application installers/upgrader for applications .... like Softaculous?   Did you use one of those?

Error is telling you:

table: mdlvo_assign_overrides
missing column timelimit

ID number of the row in that table is 816 I think.

SG should have phpmyadmin?   Use it to see the DB's mdlvo_assign_overrides table.
the mdlvo_ is the DB prefix ... table is assign_overrides
Search for id row 816
and see what is there.

Go to the course an check out assignments.
See if there any overrides.

From a 4.4.highest sandbox site.

explain mdl_assign_overrides;
+--------------------------+--------+------+-----+---------+----------------+
| Field                    | Type   | Null | Key | Default | Extra          |
+--------------------------+--------+------+-----+---------+----------------+
| id                       | bigint | NO   | PRI | NULL    | auto_increment |
| assignid                 | bigint | NO   | MUL | 0       |                |
| groupid                  | bigint | YES  | MUL | NULL    |                |
| userid                   | bigint | YES  | MUL | NULL    |                |
| sortorder                | bigint | YES  |     | NULL    |                |
| allowsubmissionsfromdate | bigint | YES  |     | NULL    |                |
| duedate                  | bigint | YES  |     | NULL    |                |
| cutoffdate               | bigint | YES  |     | NULL    |                |
| timelimit                | bigint | YES  |     | NULL    |                |

'SoS', Ken

回复Ken Task

Re: Error reading from database when I try to reset a course

Bethany B -

Ken, thank you!  You really are a superstar on these forums!

Okay, bear with me a bit here as I am wholly untrained in this and stumble my way through it all...

There were no assignment overrides on the assignments in that course.  I tracked down the assignment ID (816) and just deleted it.  The "error reading database" just advanced to the next (817), though.  The 817 assignment also does not have any overrides; it does not even have a due date, just like the 816 assignment.

Error reading from database

More information about this error

Debug info: Unknown column 'timelimit' in 'field list'
SELECT id, groupid, userid, duedate, sortorder, timelimit FROM mdlvo_assign_overrides WHERE assignid = ?
[array (
0 => '817',
)]
Error code: dmlreadexception×Dismiss this notification
Stack trace:
line 494 of /lib/dml/moodle_database.php: dml_read_exception thrown
line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
line 1398 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
line 1513 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
line 1464 of /lib/dml/moodle_database.php: call to moodle_database->get_records_select()
line 166 of /mod/assign/lib.php: call to moodle_database->get_records()
line 118 of /mod/assign/lib.php: call to assign_prepare_update_events()
line 1126 of /course/lib.php: call to assign_refresh_events()
line 1108 of /course/lib.php: call to course_module_calendar_event_update_process()
line 5297 of /lib/moodlelib.php: call to course_module_bulk_update_calendar_events()
line 78 of /course/reset.php: call to reset_course_userdata()

Sure enough, my mdlvo_assign_overrides table does not have a timelimit column.  Can I just add that column so it is just like the sandbox table print-out you shared?  Will that negatively impact anything else?

Siteground's staff did the server install stuff for me (I kept putting off the upgrades because I was intimidated and not sure where to turn for help; now I just jumped in).  Siteground did the 3.10.3 to 4.1.2 for me; I poked around to make sure my content was intact.  Then they upgraded from 4.1.2 to 4.4.1+ and I am trying to prep the courses for the new school year as a moodle administrator.  So, to answer your questions, I have no idea about Softaculous as that is not something I have heard of.  

What do you think I should do now?  Is this evidence of a graver issue with the upgrade?  

With a grateful heart,

Bethany

回复Bethany B

Re: Error reading from database when I try to reset a course

Ken Task -
Particularly helpful Moodlers的头像

Thanks for kind comment, but a 'superstar' [NOT] like me has gained that rep by guessing right - 3 times in a row! :|

Right now, you don't need that!

From what you have shared, I'd advise contacting SG support and share with them the issue you are seeing.
The error is a missing column issue and any/all assignments will have problems. And, there could be more missing columns. 伤心

Can't drop the table from the database because you've created some. So editing the table to create the missing column is required.

Considering your level of experience ... mine is actually not much more than yours with this issue ... SG staff should be able to add a column to a table - and like I said, there might be more.

Good luck!

'SoS', Ken

回复Ken Task

Re: Error reading from database when I try to reset a course

Visvanath Ratnaweera -
Particularly helpful Moodlers的头像 Translators的头像
I would be scared if my database starts missing table columns. The last time I found missing table columns (in somebody else's Moodle) was a super clever one-click tool doing hyper-jumps (not supported upgrades across multiple versions).
回复Bethany B

Re: Error reading from database when I try to reset a course

Paul Holden -
Core developers的头像 Moodle HQ的头像 Moodle Workplace team的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像 Testers的头像

Hi Bethany, that column should have been created as part of the 4.0 upgrade step (relevant change from MDL-68913) - as others have said above, I'd be dubious as to whether there aren't more inconsistencies in your database if upgrade steps are being skipped

There's a tool to verify the integrity of your database schema, I'm sure others here can point you at it

回复Paul Holden

Re: Error reading from database when I try to reset a course

Ken Task -
Particularly helpful Moodlers的头像

@Paul ... thank for confirming my thoughts.   Unfortunately, OP doesn't appear to be command line savy and last time I was in a SiteGround (SG) panel, there was no terminal.  SG was building their own panel - not WHM/cPanel/Plesk/Webmin/DirectAdmin.

One of these days other providers will follow what RackSpace (RS) does with their control panel.   RS allows the OP to setup a support account which has access to certain tools but can use a Terminal and sudo.

Then, there is moodle itself ... a commercial plugin could be offered that is a web based shell (something like the moodleadminer plugin for the DB) ... restricted to users account space ... thus could run those CLI tools that come with Moodle code.

So, again ... strongly suggest contacting SG support and share with them what has been said here ... and hope that they will fix it. :|

'SoS', Ken

回复Paul Holden

Re: Error reading from database when I try to reset a course

Bethany B -
Thank you, Paul!

Yes, I managed to add the timelimit column to see what happened and it passed the error along to the another assignment. More problems have emerged so I am an dashing around looking for advice on what to do next. I really appreciate you weighing in on my mess! 微笑
回复Bethany B

Re: Error reading from database when I try to reset a course

Ken Task -
Particularly helpful Moodlers的头像

Guess Paul and I are doing a 'tag team' on this soooooo ... my turn.

What does "More problems have emerged" mean?   Can you share what those are?

You said SG did upgrades for you.   You should ask SG desk if they made and kept site backups for each stage of the hyperjumped march.   You might have to restore the site from one of those backups.

And one more question:   Does the SG panel have a Terminal icon?

If it does, then something can be done via command line to investigate more ... there are 2 command line only script in code/admin/cli/ called check_database_schema.php and checks.php that would help ID issues.   Am gonna venture a guess ... many issues ... that would require guruish levels with the DB.

'SoS', Ken

回复Ken Task

Re: Error reading from database when I try to reset a course

Bethany B -
"Guess Paul and I are doing a 'tag team' on this soooooo ... my turn."
Which is really appreciated! I am trying so hard to not pull my hair out over this upgrade/reset project. 微笑

"What does "More problems have emerged" mean? Can you share what those are?"
Siteground was great and helped with the "courses won't reset" issue. They reported back fixes for the following tables: mdlvo_assign, mdlvo_assign_overrides, mdlvo_assign_submission. That also fixed assignment and quiz display errors, unable to preview quizzes, and the like.

Now the only issue I can find I posted on the forum: https://moodle.org/mod/forum/discuss.php?d=460761. Quiz "Questions" page will not display. I don't know if this can be tackled as a troubleshoot or means to start back from square one (well, um, 3.10 pre-upgrade attempt).

"You said SG did upgrades for you. You should ask SG desk if they made and kept site backups for each stage of the hyperjumped march. You might have to restore the site from one of those backups."
I think they only did a backup of the original 3.10.

"And one more question: Does the SG panel have a Terminal icon?"
Forgive my lack of knowledge here, but I don't know exactly what that is. I see a "Devs" section in the site tools, but nothing looks like a place to enter commands. I really love Moodle and I like the 4.4 upgrades -- I've been dying to do this upgrade over the graded-quizzes notification feature -- but this project has me well outside of my wheelhouse. I can't wait to get back to just styling and course design. 微笑

Which leads me to ask: Where does one go for maintenance and troubleshooting on a little, simple Moodle like mine? Is this the sort of thing people contract for on Upwork or Fiverr or is there another place to find Moodle experts who can check the health of the installation and perform monthly maintenance to keep it running well?
回复Bethany B

Re: Error reading from database when I try to reset a course

Ken Task -
Particularly helpful Moodlers的头像

In your other posting about quiz ...

Error 500's are not good!  500's are a general catch-all for many things.  Turn on debugging all the way to developer and post back what that showed.   Typically those sorts of errors - but not always -  do require command line access to solve.

Question is often asked - best hosting/best support/etc. ... but no one can give a satisfactory answer due to many factors: cost/just in time technical support with expertise ... or if you stick with 'do it yourself' willingness to learn things ...  like phpmyadmin or Terminal and command line.

Actually, am kinda surprised that SG has done what they have done for you!   So that's + for SG.  Normally, hosting providers draw the line at inside applications customers choose to run on their servers.

My take - briefly described - moodle is an iceburg ... the moodle admin user/teachers/students work above 'the water line' of that iceburg.  But, the admin user could have need of 'below the water line' - situation you are in at present.  And a cravat to that, if hosting doesn't offer a Terminal in their 'dev' area, no access to command line - can't fix themselves and if hosting provider stays above that water line ... then ????

So ... from what you have described you might check into the following:

Moodle Partner
https://moodle.com/services/certified-service-providers/?country=united-states

Alot of folks find an MP to be to expensive.

Moodle Cloud
https://www.moodlecloud.com/

Alot of folks find MC to be too restrictive - they have a set of plugins you can install or ask to install ... not any/all plugins.

There are independents ... I am one of those ... but am very selective ... I won't unless there is terminal access to the site.

You mentioned 'Fiver' and other such ... you might find a person who is affordable and has the expertise, but then again, you might not.

Might be better of using Moodle's jobs site:

https://moodle.org/mod/data/view.php?d=54

So have I confused you more now? 伤心

It's a topic that has variables where only you can decide.

'SoS', Ken

回复Ken Task

Re: Error reading from database when I try to reset a course

Visvanath Ratnaweera -
Particularly helpful Moodlers的头像 Translators的头像
Ken, Paul and others

In your estimate those "forced upgrades", upgrading without going through the Moodle upgrade scrips leaving anomalies in the database, for example, do those sites have a future?
 
回复Visvanath Ratnaweera

Re: Error reading from database when I try to reset a course

Ken Task -
Particularly helpful Moodlers的头像

Think that would depend upon the issue ... so site by site inspection ... and what the possible fixes might be.

Am sure every effort would be made to keep what OP's have.  A tough lesson to learn if it's something major on a site that's been in use for years!

'SoS', Ken

回复Ken Task

Re: Error reading from database when I try to reset a course

Bethany B -
Ken, thank you! I did not know about the Moodle jobs site. MP just looks to be outside of my humble budget so I did not even request a quote in the midst of this week's chaos. I did find a very helpful guy on Fiverr yesterday to poke around and run down issues with me. It was a long day but the site is working beautifully now.

As for Siteground, they have been very supportive. It probably would have been better if they just said, "Hey, you have a pretty old Moodle, maybe find someone else to help with the upgrade." I have learned the wisdom in that the hard way. They have put up with me stumbling my way through website design for over a decade now and have always been very responsive, on top of anything that is their end, and clear with instructions with me as a newbie. I do enjoy learning more and more about PHP, servers, running Moodle, and whatnot and wish I had more time to study. This week I definitely learned that I need an experienced Moodle individual to tap for support and major changes. That is on my research list for after the new school year kicks off.

Again, I am very grateful for your posts during this (self-made) disaster. I have learned a lot from you (and others) on these forums this time and when creeping around in the past.

Have an awesome day! I am going to go get all these courses prepped for open.

Sincerely,
Bethany
回复Bethany B

Re: Error reading from database when I try to reset a course

Ken Task -
Particularly helpful Moodlers的头像

Good to hear!

"helpful guy on Fiverr yesterday" - know that this is outside the scope of these forums, but for others like yourself who need some extra support for whatever reason, would like to know how to contact that person.

I'd be interested in this ...

Did this 'fiverr guy' access your server via shell to fix or just in admin interface?

And just in case someone reads that I don't think SG is a good hosting provider ... SG went the extra mile with you ...most providers to NOT ever go into the apps customer is running to do what was needed.   Of course, they do have CLI access to sites.

And this is not over ... you will have updates/upgrades available in the future ... so it's a good idea you check server's environment frequently and update that component so you can pass along to SG support specifics.

So that others who might run across this thread know there was a fix, please respond and add [SOLVED] to the front of the subject line. 微笑

'SoS', Ken

回复Bethany B

Re: Error reading from database when I try to reset a course

Ken Task -
Particularly helpful Moodlers的头像

Don't mean to sound 'pressing', but ... these forums are a lot of 'sharing' and 'share back'.   Did the 'fiver' you hired tell you what they did to fix?

If so, mind summarizing so that others who might run across the same or similar issue on SG or other hosting might have a clue?

Thanks, in advance,

'SoS', Ken