简体   繁体   English

Magento catalog_category_flat_store_1 不存在

[英]Magento catalog_category_flat_store_1 does not exist

I have an existing store running Magento CE 1.7.我有一个运行 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) a:5:{i:0;s:111:"SQLSTATE[42S02]: 未找到基表或视图:1146 表 'XXXXXX.catalog_category_flat_store_1' 不存在";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).如果存在,则从数据库中删除catalog_category_flat_store_1 (完全删除它)。

  2. Install a new instance of Magento on a new database (or use another pre-existing Magento database)在新数据库上安装新的 Magento 实例(或使用另一个预先存在的 Magento 数据库)

  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).从新的(或现有的 Magento 数据库),将catalog_category_flat_store_1克隆到您的 Magento 数据库(出现错误的数据库)。

  4. Reindex your site - specifically the Category Flat Data index.重新索引您的站点 - 特别是Category Flat Data索引。

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.也许它已经崩溃并且 mysql 自动修复了它(但我不确定这一点),但它再次正常运行。

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 .您必须运行Catalog Category Flat Reindex

You can do this from the Magento backend: System -> Index Management or via ssh.您可以从 Magento 后端执行此操作:系统->索引管理或通过 ssh。

Using SSH go to you shell directory and run php -f indexer.php -- -reindex catalog_category_flat使用 SSH 进入你的 shell 目录并运行php -f indexer.php -- -reindex catalog_category_flat

Hope this helps you.希望这对你有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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