Magento catalog_category_flat_store_1 does not exist

半腔热情 提交于 2019-12-02 01:52:33

问题


I have an existing store running Magento CE 1.7. Suddenly from today morning (without any code updates), I am receiving the following error -

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

I can see that the table actually exists in the Database and can be accessed from the server. However, the error report is indicating that its not found.

I have so far,

-- Cleared Cache

-- Rebuilt indexes

-- Removed the table and rebuilt the index again, so that it gets created automatically and it does.

Can anyone please throw some light on this??

|improve this question

回答1:


I've had this happen before. This usually occurs when the database crashes during an indexing process, and the table gets corrupted or deleted.

I do as follows:

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

  2. Install a new instance of Magento on a new database (or use another pre-existing Magento database)

  3. From the new (or existing Magento database), clone the catalog_category_flat_store_1 to your Magento database (the one that is having the error).

  4. Reindex your site - specifically the Category Flat Data index.




回答2:


I had the same problem yesterday night, but the table seems to exist and used/updated as normally today. Maybe it has crashed and mysql fixed it automatically (but I am not sure of this), but it functions normally again.

Rest log:

    #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')  



回答3:


This issue can be resolved by reindexing.

You have to run Catalog Category Flat Reindex.

You can do this from the Magento backend: System -> Index Management or via ssh.

Using SSH go to you shell directory and run php -f indexer.php -- -reindex catalog_category_flat

Hope this helps you.



来源:https://stackoverflow.com/questions/19398361/magento-catalog-category-flat-store-1-does-not-exist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!