CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • DB Error: invalid view when running the upgrade script.
Pages: [1]

Author Topic: DB Error: invalid view when running the upgrade script.  (Read 2107 times)

Mich___

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 0
  • CiviCRM version: 4.7.6
  • CMS version: WordPress
  • MySQL version: 5
  • PHP version: 5.4.32
DB Error: invalid view when running the upgrade script.
February 20, 2015, 11:37:46 pm
Hi.

I have serious issues re-connecting with my database.
I had previously upgraded, the upgrade worked but we had some "blank screen issues" using some functions.

I started the whole installing and upgrading process again - install a new civicrm package - relocate the settings file -
I deleted the database, created a new one with the same name and I imported the database backup (sql)

Now I can´t run the upgrade script, it gives me a DB Error: invalid view

(If I install civicrm (instead of upgrade), without relocating the settings file and with a blank new database it works, but then I won´t have access to all my data.)


I tried several backups of my database but none seems to function with the upgrade link.

does the civicrm.settings.php find the database only through the database link in the
script or is there also a specific number that makes one settings script just work with
the database it worked before (f.e. id...)

I am a bit lost.
Thank you!


p.s. when trying to upload my most recent backup of the database I get this error:

ERROR 1452 (23000) at line 838893: Cannot add or update a child row: a foreign key constraint fails (`gemeingut_civicrm_jetzt`.`#sql-7516_214249`, CONSTRAINT `FK_civicrm_mailing_event_subscribe_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)

Oh no.





« Last Edit: February 21, 2015, 02:07:57 am by Mich___ »

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: DB Error: invalid view when running the upgrade script.
February 21, 2015, 02:43:49 am
Try doing your import with foreign key checks off ..
 http://www.stetsenko.net/2008/10/mysql-how-to-ignore-checking-of-foreign-key-constraints-for-innodb-tables/

Although - TBH I would have expected the civicrm_contact table to be fully loaded by the time you hit that table (based on alpha order)
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Mich___

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 0
  • CiviCRM version: 4.7.6
  • CMS version: WordPress
  • MySQL version: 5
  • PHP version: 5.4.32
Re: DB Error: invalid view when running the upgrade script.
February 21, 2015, 03:51:53 am
Thank you for this hint! SET FOREIGN_KEY_CHECKS = 0;
It indeed helped me to upload the database (further struggles further down).

But still, a blank page and error 500 will follow when starting civicrm.


May I ask if I am logically on the right track?

As I made the mistake to completely delete my database - I had to created a new one (with a new name) where i imported the backup database file -

Because I deleted my database I have to treat my installation not as an upgrade but as if I would have moved locations/database/server.
Therefore I made a clean install following these instructions:

which "civicrm_domain" table i first changed according to these instructions:

Alternatively, If both of these solutions fail: 1/. run a clean database installation to a new database (by deleting/renaming civicrm.settings.php). 2/. Confirm that this clean installation works 3/. Download clean database. 4/. Replace the SQL for the `civicrm_domain`  table in your original database with the new SQL from the clean database. 5/. Upload the updated original database. 6/. edit civicrm.settings.php to repoint to the original database. 7/. rebuild the menus as instructions above


When trying to open Civicrm I will get a blank screen /
Failed to load resource: the server responded with a status of 500 (Internal Server Error)    http://www.gemeingut.org/wp-admin/admin.php?page=CiviCRM

- The database is there, (the database civicrm_domain table has been integrated from the clear install before the upload)
- the civicrm.settings.php points to the right new database ,
- the browser cache is cleared

I cannot access civicrm menu to clear the civicrm cash but tried:
I tried this link but it just showed a blank screen:
http://<wordpress install>/wp-admin/admin.php?page=CiviCRM&q=civicrm/admin/setting/updateConfigBackend&reset=1


Still a blank screen.

When I try to change the DB link back to the empty clear database in civicrm.setting.php, CIVICRM works fine., but obviously without my data

When I use the link to the new database (the backup) - blank screen.

What would be my next steps?
Thank you very much for any hints!
« Last Edit: February 21, 2015, 09:01:36 am by Mich___ »

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: DB Error: invalid view when running the upgrade script.
February 21, 2015, 09:23:16 am
"As I made the mistake to completely delete my database - I had to created a new one (with a new name) where i imported the backup database file -"

Why didn't you just use the same name? ie. import your backup into the empty DB?

NB you may need to delete any triggers in your DB if you change DB name
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Mich___

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 0
  • CiviCRM version: 4.7.6
  • CMS version: WordPress
  • MySQL version: 5
  • PHP version: 5.4.32
Re: DB Error: invalid view when running the upgrade script.
February 21, 2015, 10:13:48 am
Oh I tried the same name first, there seems to be no difference (I created a new database with the same name).

But would that be the best option? I will try to re-create that again.
In case I need to delete any triggers. What exactly do you mean with triggers?


Thanks so much.
« Last Edit: February 21, 2015, 10:43:13 am by Mich___ »

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: DB Error: invalid view when running the upgrade script.
February 21, 2015, 10:58:49 am
triggers http://dev.mysql.com/doc/refman/5.0/en/trigger-syntax.html
 but if your db name is unchanged it shouldn't matter
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Mich___

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 0
  • CiviCRM version: 4.7.6
  • CMS version: WordPress
  • MySQL version: 5
  • PHP version: 5.4.32
Re: DB Error: invalid view when running the upgrade script.
February 21, 2015, 12:34:51 pm
1)
Still the same problem, even if the database name is original. blank page, 500 error.

Could be the problem that I backed up  the database via "Export" in mysql" quick option?
Or when I create a database with the same name as the lost one, it still has different table locations?

2)
I also tried to install an old backup - before the upgrade - and tried to run the upgrade script
again - error message: DB Error: invalid view
(this time: http://www.gemeingut.org/wp-admin/admin.php?page=CiviCRM&q=civicrm/ajax/l10n-js/de_DE&r=njDc


 
« Last Edit: February 21, 2015, 01:21:48 pm by Mich___ »

Mich___

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 0
  • CiviCRM version: 4.7.6
  • CMS version: WordPress
  • MySQL version: 5
  • PHP version: 5.4.32
Re: DB Error: invalid view when running the upgrade script.
February 23, 2015, 03:12:54 am
I checked my php error log and it showed this:

[23-Feb-2015 01:44:02 UTC] PHP Fatal error: Cannot redeclare get_template() (previously declared in /home/gemeingut/www/www/wp-includes/theme.php:285) in /home/gemeingut/www/www/wp-content/plugins/files/civicrm/custom_ext/sfe.donationreceipts/backend.php on line 276

I exchanged backend.php with the packend.php from my civicrm folder backup,
I will not get the 500 error anymore.

This is the new error: DB Error: no such field

Here the error log:

[23-Feb-2015 11:45:36 Europe/Berlin] PHP Fatal error: Call to undefined function is_admin() in /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/Base.php on line 83


On line 83 I could find this code:
if (is_admin()) {
require_once (ABSPATH . 'wp-admin/admin-header.php');
}
else {
// FIX ME: we need to figure out to replace civicrm content on the frontend pages
}
}


What does it mean, and what could be a fix?
Best wishes and thanks, Michael

p.s. this is the error log by civicrm:

Feb 23 12:17:38  [info] $backTrace = #0 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(239): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/packages/DB.php(975): PEAR_Error->PEAR_Error("DB Error: no such field", -19, 16, (Array:2), "\nSELECT  v.label as label ,v.name as value, v.grouping as grouping\nFROM   c...")
#4 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-19, 16, (Array:2), "\nSELECT  v.label as label ,v.name as value, v.grouping as grouping\nFROM   c...")
#5 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -19, NULL, NULL, "\nSELECT  v.label as label ,v.name as value, v.grouping as grouping\nFROM   c...", "DB_Error", TRUE)
#6 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/packages/DB/mysql.php(899): DB_common->raiseError(-19, NULL, NULL, NULL, "1054 ** Unknown column 'v.label' in 'field list'")
#7 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
#8 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("\nSELECT  v.label as label ,v.name as value, v.grouping as grouping\nFROM   c...")
#9 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2442): DB_common->query("\nSELECT  v.label as label ,v.name as value, v.grouping as grouping\nFROM   c...")
#10 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(1634): DB_DataObject->_query("\nSELECT  v.label as label ,v.name as value, v.grouping as grouping\nFROM   c...")
#11 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(325): DB_DataObject->query("\nSELECT  v.label as label ,v.name as value, v.grouping as grouping\nFROM   c...")
#12 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(1116): CRM_Core_DAO->query("\nSELECT  v.label as label ,v.name as value, v.grouping as grouping\nFROM   c...", TRUE)
#13 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/CRM/Core/OptionGroup.php(152): CRM_Core_DAO::executeQuery("\nSELECT  v.label as label ,v.name as value, v.grouping as grouping\nFROM   c...", (Array:1))
#14 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/CRM/Core/PseudoConstant.php(321): CRM_Core_OptionGroup::values("languages", FALSE, FALSE, FALSE, NULL, "label", TRUE, FALSE, "name")
#15 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Contact.php(3255): CRM_Core_PseudoConstant::get("CRM_Contact_BAO_Contact", "preferred_language", (Array:0), NULL)
#16 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/CRM/Core/I18n.php(129): CRM_Contact_BAO_Contact::buildOptions("preferred_language")
#17 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Smarty.php(165): CRM_Core_I18n::languages(TRUE)
#18 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Smarty.php(183): CRM_Core_Smarty->initialize()
#19 /home/gemeingut/www/www/wp-content/plugins/files/civicrm/custom_ext/sfe.donationreceipts/donationreceipts.civix.php(13): CRM_Core_Smarty::singleton()
#20 /home/gemeingut/www/www/wp-content/plugins/files/civicrm/custom_ext/sfe.donationreceipts/donationreceipts.php(29): _donationreceipts_civix_civicrm_config(Object(CRM_Core_Config))
#21 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook.php(194): donationreceipts_civicrm_config(Object(CRM_Core_Config))
#22 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook.php(133): CRM_Utils_Hook->runHooks((Array:2), "civicrm_config", 1, Object(CRM_Core_Config), NULL, NULL, NULL, NULL, NULL)
#23 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook/WordPress.php(69): CRM_Utils_Hook->commonInvoke(1, Object(CRM_Core_Config), NULL, NULL, NULL, NULL, NULL, "civicrm_config", "wordpress")
#24 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook.php(907): CRM_Utils_Hook_WordPress->invoke(1, Object(CRM_Core_Config), NULL, NULL, NULL, NULL, NULL, "civicrm_config")
#25 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Config.php(256): CRM_Utils_Hook::config(Object(CRM_Core_Config))
#26 /home/gemeingut/www/www/wp-content/plugins/civicrm/civicrm/bin/cron.php(32): CRM_Core_Config::singleton()
#27 {main}
« Last Edit: February 23, 2015, 03:20:33 am by Mich___ »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • DB Error: invalid view when running the upgrade script.

This forum was archived on 2017-11-26.