Course Restore is not working properly

Course Restore is not working properly

by Ashafak Shekh -
Number of replies: 4

I have upgraded moodle 3.2.9 to lates 3.5+ (stabel version) however while restoring course following error has come 

-----

Error reading from database

More information about this error

Debug info: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'utf8'
SELECT COUNT(*) FROM ( SELECT c.id, c.name, c.visible, c.sortorder, c.description, c.descriptionformat , ctx.id AS ctxid, ctx.path AS ctxpath, ctx.depth AS ctxdepth, ctx.contextlevel AS ctxlevel, ctx.instanceid AS ctxinstance FROM mdl_course_categories c LEFT JOIN mdl_context ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = ?) WHERE LOWER(c.name) LIKE LOWER(?) COLLATE utf8mb4_bin ESCAPE '\\' ) sel
[array (
0 => 40,
1 => '%%',
)]
Error code: dmlreadexception


------

Stack trace:

  • line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
  • line 1246 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 1571 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
  • line 1644 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
  • line 1854 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
  • line 190 of /backup/util/ui/restore_ui_components.php: call to moodle_database->count_records_sql()
  • line 125 of /backup/util/ui/restore_ui_components.php: call to restore_search_base->search()
  • line 275 of /backup/util/ui/renderer.php: call to restore_search_base->get_count()
  • line 537 of /backup/util/ui/restore_ui_stage.class.php: call to core_backup_renderer->course_selector()
  • line 153 of /backup/restore.php: call to restore_ui_stage_destination->display()


----------


Please help me with appropriate solution, it will be great help 


Thanks in advance


Attachment Error moodle.png
Average of ratings: -
In reply to Ashafak Shekh

Re: Course Restore is not working properly

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
In reply to Howard Miller

Re: Course Restore is not working properly

by Ashafak Shekh -

Hi Howard,


I tried solution mentioned in the link 

https://moodle.org/mod/forum/discuss.php?d=370219


However it is still the same for me, no luck. 


In reply to Ashafak Shekh

Re: Course Restore is not working properly

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Are you restoring to a different site? Does the site have its database configured for mb4?

In reply to Ashafak Shekh

Re: Course Restore is not working properly

by Ken Task -
Picture of Particularly helpful Moodlers

First, make an sql dump of database for moodle.  Even if it's messed up right now, better to have something to restore than nothing .... just in case.

https://dev.mysql.com/doc/refman/5.7/en/charset-collation-compatibility.html
"Each character set has one or more collations, but each collation is associated with one and only one character set"
Collation in MySQL can be complicated because you can have a separate collation set at: The database level, The table level, The column level


The table: mdl_course_categories in this case but more than likely other
tables could have issues.

In the moodle code @ admin/cli/ run the following:

php mysql_collation.php -a will show available collatons.
php mysql_collation.php -l will show the collations for all tables.

The --collation=COLLATION option will Convert MySQL tables to different collation

Could we get a peak at your my.cnf file (config for MySQL)?  Double check what's in [mysqld] section/config lines and see if there is a [client] section that has related config lines.  We are looking for 'character_set_' settings.

'spirit of sharing', Ken