Upgrading problem Moodle 2.6.1 into 2.7.2

Upgrading problem Moodle 2.6.1 into 2.7.2

by Paul K -
Number of replies: 10

Hi,

I'm having the following problem during the upgrade process between Moodle 2.6.1 and 2.7.2.

After starting the database upgrade process I'm receiveing the following error:

Table "qtype_randomsamatch_options" exists already

Debug info:can not rename table
Error code: ddltablealreadyexists

Stack trace:

  • line 500 of \lib\ddl\database_manager.php: ddl_exception thrown
  • line 54 of \question\type\randomsamatch\db\upgrade.php: call to database_manager->rename_table()
  • line 535 of \lib\upgradelib.php: call to xmldb_qtype_randomsamatch_upgrade()
  • line 1615 of \lib\upgradelib.php: call to upgrade_plugins()
  • line 434 of \admin\index.php: call to upgrade_noncore()


I have deleted this table, just to check whether it will be possible to finish the installation process. Hovewer, then I'm getting the problem with the next table:

Table "quiz_slots" exists already


Debug info:can not rename table
Error code: ddltablealreadyexists
Stack trace:

  • line 500 of \lib\ddl\database_manager.php: ddl_exception thrown
  • line 524 of \mod\quiz\db\upgrade.php: call to database_manager->rename_table()
  • line 697 of \lib\upgradelib.php: call to xmldb_quiz_upgrade()
  • line 420 of \lib\upgradelib.php: call to upgrade_plugins_modules()
  • line 1615 of \lib\upgradelib.php: call to upgrade_plugins()
  • line 434 of \admin\index.php: call to upgrade_noncore()


Do you know any solution for this or any reason why it happens? I need to update the productive system within 3-5 days, therefore I will appreciate for any suggestion regarding this case.

Best regards,

Paul



Average of ratings: -
In reply to Paul K

Re: Upgrading problem Moodle 2.6.1 into 2.7.2

by Rodney Wolford -

Paul,

For me, and maybe others, I don't think you've provided enough detail to figure out what is happening. Usually, when moving from one Moodle version to another, the database is not touched. Here is the process from the moodle site.  https://docs.moodle.org/27/en/Upgrading#Put_your_site_into_maintenance_mode Notice the comment in line 2 I have bolded.

  1. Move your old Moodle software program files to another location. Do NOT copy new files over the old files.
  2. Unzip or unpack the upgrade file so that all the new Moodle software program files are in the location the old files used to be in on the server. Moodle will adjust SQL and moodledata if it needs to in the upgrade.
  3. Copy your old config.php file back to the new Moodle directory.
  4. As mentioned above, if you had installed any plugins on your site you should add them to the new code tree now. It is important to check that you get the correct version for your new version of Moodle. Be particularly careful that you do not overwrite any code in the new version of Moodle.
  5. Don't forget to also copy over your moodledata folder / directory. If you don't you will get a "fatal error $cfg- dataroot is not configured properly".

What are doing that is different from this? Are you using git, or the command line options?

Regards,

Rod

In reply to Rodney Wolford

Re: Upgrading problem Moodle 2.6.1 into 2.7.2

by Carlos Chiarella -

Hi all,


I have the same issue when updating from Moodle 2.6.1 to Moodle 2.7.2.


Debug info: can not rename table
Error code: ddltablealreadyexists
Stack trace: line 500 of /lib/ddl/database_manager.php: ddl_exception thrown
line 54 of /question/type/randomsamatch/db/upgrade.php: call to database_manager->rename_table()
line 535 of /lib/upgradelib.php: call to xmldb_qtype_randomsamatch_upgrade()
line 1615 of /lib/upgradelib.php: call to upgrade_plugins()
line 434 of /admin/index.php: call to upgrade_noncore()

Did anybody has a solution?


Thanks for your help,


Carlos

In reply to Carlos Chiarella

Re: Upgrading problem Moodle 2.6.1 into 2.7.2

by nivedita setru -

Before you started upgrading from 2.6.1 to 2.7.2, did you check if qtype_randomsamatch_options exists?


In reply to Carlos Chiarella

Re: Upgrading problem Moodle 2.6.1 into 2.7.2

by Xavier Foguet -

Carlos did you figured out how to solve this?


In reply to Xavier Foguet

Re: Upgrading problem Moodle 2.6.1 into 2.7.2

by Daniel Bosse -

I have the same problem!

Nothing worked.

qtype_randomsamatch

Tabelle "qtype_randomsamatch_options" ist bereits vorhanden

Debug info: can not rename table
Error code: ddltablealreadyexists
Stack trace:
  • line 500 of /lib/ddl/database_manager.php: ddl_exception thrown
  • line 54 of /question/type/randomsamatch/db/upgrade.php: call to database_manager->rename_table()
  • line 537 of /lib/upgradelib.php: call to xmldb_qtype_randomsamatch_upgrade()
  • line 1626 of /lib/upgradelib.php: call to upgrade_plugins()
  • line 434 of /admin/index.php: call to upgrade_noncore()
In reply to Daniel Bosse

Re: Upgrading problem Moodle 2.6.1 into 2.7.2

by António Godinho -

I've the same problem, from 2.5.8 to 2.6.10.


Log:

[Mon Apr 06 09:55:35.399716 2015] [:error] [pid 29196] [client 192.168.120.77:13168] Default exception handler: Table "qtype_randomsamatch_options" already exists Debug: can not rename table\nError code: ddltablealreadyexists\n* line 505 of /lib/ddl/database_manager.php: ddl_exception thrown\n* line 54 of /question/type/randomsamatch/db/upgrade.php: call to database_manager->rename_table()\n* line 531 of /lib/upgradelib.php: call to xmldb_qtype_randomsamatch_upgrade()\n* line 1601 of /lib/upgradelib.php: call to upgrade_plugins()\n* line 438 of /admin/index.php: call to upgrade_noncore()\n, referer: http://moodle.isec.pt/moodle/admin/index.php


From the webpage:

qtype_randomsamatch

Table "qtype_randomsamatch_options" already exists

More information about this error

Debug info: can not rename table
Error code: ddltablealreadyexists
Stack trace:
  • line 505 of /lib/ddl/database_manager.php: ddl_exception thrown
  • line 54 of /question/type/randomsamatch/db/upgrade.php: call to database_manager->rename_table()
  • line 531 of /lib/upgradelib.php: call to xmldb_qtype_randomsamatch_upgrade()
  • line 1601 of /lib/upgradelib.php: call to upgrade_plugins()
  • line 438 of /admin/index.php: call to upgrade_noncore()


Also:

mysql> select * from qtype_randomsamatch_options;

ERROR 1146 (42S02): Table 'dbmoodle.qtype_randomsamatch_options' doesn't exist

mysql>


Any advice?


In reply to António Godinho

Re: Upgrading problem Moodle 2.6.1 into 2.7.2

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

This normally happens after a failed upgrade.  Go into your database and rename ALL of the qtype tables that might exist to qtype_randomsamatch_options_old, for example.  Or make a copy and then delete.  Just make sure that you have a copy of them.

Then rerun the upgrade, which should complete normally.  Then, go back to the database, and check that all tables were recreated.  If any are missing, rename the old table back to the correct name and you should be good to go.

Check your installation by making sure that you can open and edit questions of all different question type.

In reply to António Godinho

Re: Upgrading problem Moodle 2.6.1 into 2.7.2

by Liam McDonagh-Greaves -

Slightly Different Solution

I have just got round this problem, whilst upgrading from 2.5 to 2.8. Lots of the tables (not just qtype) were saying this sort of thing:


Emma's very helpful post set me on the right track. However, after renaming all of the qtype tables, I was then getting messages saying, e.g.:


So, I renamed all of the qtype tables back to their original names. Time to start over.

I ran the database update again. I saw the error about the qtype table already existing, but this time I only renamed that one table, then tried the update again. This time, the update got slightly further.

After this point, it was plain (if slow!) sailing. The key was that whenever I saw a "table already exists" error, I only renamed tables that were specifically mentioned as "already existing".

Each time I saw an error saying "table already exists", I added "_old" to the end of its title. Attempting to update the database again usually resulted in a few more tables being updated, and then Moodle would report that yet another one "already existed". I went through, renaming, updating, renaming, updating, and eventually the update completed.

A quick note: I found that in order to get the "mdl_tool_monitor" family to update, I had to rename "subscriptions", "history" and "events" tables all in one go.

Hope this helps someone!

Liam

In reply to Liam McDonagh-Greaves

Re: Upgrading problem Moodle 2.6.1 into 2.7.2

by Benjamin Ellis -
Picture of Particularly helpful Moodlers

Ran into this issue on upgrading 2.6.4 to 2.9.1 after having to rollback as a rollback test.    Mysqldumps restores do not remove tables and so tables from the 1st round of the upgrade still existed.  I found that dropping the database and restoring the pre-upgrade tables - mean that the 2nd upgrade attempt worked without issues.

In reply to Liam McDonagh-Greaves

Re: Upgrading problem Moodle 2.6.1 into 2.7.2

by Hugh Edwards -

Hi Liam, 

This has very much helped - thank you! smile 


Hugh.