Magento catalog_category_flat_store_1 does not exist

I have a store running Magento CE 1.7. Suddenly from this morning (without any code updates) I get the following error:

a: 5: {i: 0; s: 111: "SQLSTATE [42S02]: the underlying table or view was not found: 1146 Table 'XXXXXX.catalog_category_flat_store_1' does not exist"; i: 1; s: 5914: "# 0 / var / www / lib / Varien / Db / Statement / Pdo / Mysql.php (110): Zend_Db_Statement_Pdo-> _ execute (Array)

I see that the table actually exists in the database and can be accessed from the server. However, the error message indicates that it was not found.

I'm so far away

- cleared cache

- Rebuilt indexes

- I deleted the table and rebuilt the index so that it is created automatically, and it does it.

Can someone please shed some light on this ??

+2
source share
3 answers

I had it before. This usually happens when the database crashes during the indexing process, and the table gets corrupted or deleted.

I do the following:

  • Drop catalog_category_flat_store_1 from the database if it exists (delete it completely).

  • Install a new instance of Magento in a new database (or use another existing Magento database)

  • From the new (or existing Magento database), clone catalog_category_flat_store_1 into your Magento database (the one that has the error).

  • - , Category Flat Data.

+1

, , , /, . , , mysql ( ), .

:

    #1 /public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
    #2 public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `main_table`.* FROM `catalog_category_flat_store_1` AS `main_table` WHERE (entity_id IN ('258', '38', '3', '1')) AND (custom_use_parent_settings = 0) AND (level != 0) ORDER BY `level` DESC', Array)
    #3 public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(337): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `main_table`.* FROM `catalog_category_flat_store_1` AS `main_table` WHERE (entity_id IN ('258', '38', '3', '1')) AND (custom_use_parent_settings = 0) AND (level != 0) ORDER BY `level` DESC', Array)
    #4 public_html/lib/Zend/Db/Adapter/Abstract.php(753): Varien_Db_Adapter_Pdo_Mysql->query(Varien_Db_Select, Array)
    #5 public_html/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Flat.php(1108): Zend_Db_Adapter_Abstract->fetchRow(Varien_Db_Select)
    #6 public_html/app/code/core/Mage/Catalog/Model/Category.php(841): Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Flat->getParentDesignCategory(Mage_Catalog_Model_Category)
    #7 public_html/app/code/core/Mage/Catalog/Model/Design.php(348): Mage_Catalog_Model_Category->getParentDesignCategory(Mage_Catalog_Model_Category)
    #8 public_html/app/code/core/Mage/Catalog/Helper/Product/View.php(49): Mage_Catalog_Model_Design->getDesignSettings(MDN_AdvancedStock_Model_Catalog_Product)
    #9 public_html/app/code/core/Mage/Catalog/Helper/Product/View.php(144): Mage_Catalog_Helper_Product_View->initProductLayout(MDN_AdvancedStock_Model_Catalog_Product, Mage_Catalog_ProductController)
    #10 public_html/app/code/core/Mage/Catalog/controllers/ProductController.php(132): Mage_Catalog_Helper_Product_View->prepareAndRender(3790, Mage_Catalog_ProductController, Varien_Object)
    #11 public_html/app/code/local/Mage/Core/Controller/Varien/Action.php(422): Mage_Catalog_ProductController->viewAction()
    #12 public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(253): Mage_Core_Controller_Varien_Action->dispatch('view')
    #13 public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Mage_Core_Controller_Request_Http)
    #14 public_html/app/code/core/Mage/Core/Model/App.php(340): Mage_Core_Controller_Varien_Front->dispatch()
    #15 public_html/app/Mage.php(627): Mage_Core_Model_App->run(Array)
    #16 public_html/index.php(80): Mage->run('', 'store')  
0

.

Flat Reindex.

Magento: ssh.

SSH php -f indexer.php -- -reindex catalog_category_flat

Hope this helps you.

0
source

All Articles