Fix missing module table when DB privileges changes

Tested on Drupal 5.x

Often we haven’t a full control of machines we have sites hosted in. It’s called “shared hosting”, and it could be cheap as problematic. On a such environment, I had some privileges like “CREATE TABLE, CREATE VIEW” etc. revoked for some weeks. Results? Some enabled modules missed their table, and some CCK fields cannot store their content.

Symptoms: on admin/logs/watchdog you get errors like this:
Table 'echoz2.dbprefix_scheduler' doesn't exist query: SELECT * FROM drp_running_scheduler WHERE nid = 1481 in ...

After privileges are restored, to solve this issue recreating missing tables you have to:

  1. Backup your database.
  2. Disable tainted module
  3. Via phpMyAdmin or similar tools, go to system table (e.g. dbprefix_system) and delete the disabled module row, e.g.
    filename name type description status throttle bootstrap schema_version weight
    sites/all/modules/scheduler/scheduler.module scheduler module This module allows nodes to be published and unpub… 0 0 0 2 0

    Check that status is set to 0. Otherwise do not delete this row!

  4. Reload the module page and enable the module.

Now table for this module will be recreated. For each “table doesn’t exist” error you have to follow these steps. Note that all saved settings (if exists) for that module will be lost.

%d bloggers like this: