1

This morning, a plugin update broke the website, so we did a restore from a backup from the previous day. CiviCRM was working properly at the time, but now when we try to access it, we get the following error:

Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => simpleHandler
        )

    [code] => -18
    [message] => DB Error: no such table
    [mode] => 16
    [debug_info] => SELECT *,  config_backend, locales, locale_custom_strings  
 FROM civicrm_domain 

 WHERE (  civicrm_domain.id = 1 )  



 [nativecode=1146 ** Table 'frenchf_crm.civicrm_domain' doesn't exist]
    [type] => DB_Error
    [user_info] => SELECT *,  config_backend, locales, locale_custom_strings  
 FROM civicrm_domain 

 WHERE (  civicrm_domain.id = 1 )  



 [nativecode=1146 ** Table 'frenchf_crm.civicrm_domain' doesn't exist]
    [to_string] => [db_error: message="DB Error: no such table" code=-18 mode=callback callback=CRM_Core_Error::simpleHandler prefix="" info="SELECT *,  config_backend, locales, locale_custom_strings  
 FROM civicrm_domain 

 WHERE (  civicrm_domain.id = 1 )  




 [nativecode=1146 ** Table 'frenchf_crm.civicrm_domain' doesn't exist]"]
)

Any idea on what this means and how we can go about fixing it? Thanks.

1

As you can probably tell, CiviCRM is looking for a table that doesn't exist (at least where it's looking). Given your context, there are a few possibilities for why.

CiviCRM creates a bunch of tables that are independent of WordPress and about which WordPress has no knowledge. They may be in the same database as WordPress, or they may be in a separate database. The connection to the database is stored in wp-content/plugins/civicrm/civicrm.settings.php. There, you'll see two lines of database information: "CIVICRM_UF_DSN" for the WordPress database connection, and "CIVICRM_DSN" for the CiviCRM database connection.

So, the possible situations:

  1. You have separate databases, and you have been only backing up the WordPress database. You'll see this if your database connections in civicrm.settings.php differ from each other. The good news is that if this is the case, you might be able to find the old CiviCRM database sitting around somewhere, and it would probably be unaffected from a bad plugin.

  2. You were only backing up the WordPress tables. Even if CiviCRM is in the same database as WordPress, if you're using a WordPress tool for backup, it might decide to only handle certain tables. If this is the case, you may be out of luck unless you still have the pre-restore database around.

  3. You failed to update civicrm.settings.php after restoring the site. If you had Database A running the site, and you restored the backup to Database B, you'd need to update wp-config.php and wp-content/plugins/civicrm/civicrm.settings.php. If you neglected to do the latter, and you got rid of your old database, you'd see this. Likewise, if you simply changed the password on the database user and forgot to update civicrm.settings.php, you'd have this sort of problem.

  • Thank you for your detailed answer, I really appreciate it. As I was not the one actually doing the backup, I will forward to the person who did it and see if this makes sense to him. For whatever reason, when we looked at database listed in CIVICRM_DSN path in the civicrm_settings.php, it indeed did NOT have civicrm_domain table. Would there have been any way this got deleted during the backup, even if he did not touch the crm database at all? I will get confirmation from him regardless, but thank you again for explaining the error to me. – papayapaya Dec 9 '15 at 2:46
  • 1
    Are any of the civicrm_... tables in that database? If so, you have a really strange situation. If not, maybe your colleague connected to or restored with the wrong database. – Andrew Hunt Dec 9 '15 at 4:34
  • Yes, but it looks like all the tables after the ones called BATCH got dropped? – papayapaya Dec 9 '15 at 15:06
  • Hmm. I wonder if something failed in your backup. If MySQL runs into an error in generating a dump, the file might cut off. If you load that file, it would populate all the tables up until that point. – Andrew Hunt Dec 9 '15 at 20:37
  • That's what I was asking the guy who did the backup, but he said he didn't notice any errors during the process of backing up data. I'm having him check older backups to see if how it compares to the newer backup files he has. Thank you again for your replies. – papayapaya Dec 9 '15 at 21:01
0

One of the reason for the following Error:

you get this error if you have restored your latest civicrm database (eg.4.7.8) and you are still having your old civicrm Core (eg: 4.6)

so just replace your Civicrm Core files to the latest one should fix the issue

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.