简体   繁体   中英

Magento catalog_category_flat_store_1 does not exist

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??

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.

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM