2015-02-09 78 views
1

我正在嘗試創建一個Magento網站的本地副本,以便我可以執行一些測試以嘗試並解決問題發生了,它看起來像是一個馴服的問題,但是當我們嘗試在實況網站上進行重新索引時,它會破壞整個事情。複製Magento網站會導致SQLSTATE [23000]:完整性約束違規:1062重複條目

我按照這裏的說明Copying a Magento site,但我在嘗試查看網站時遇到錯誤。我得到的錯誤是:

SQLSTATE [23000]:完整性約束違規:1062重複條目 「1464841」關鍵「PRIMARY」

說實話,它開始把我逼瘋,這似乎很簡單 - 只需複製文件&數據庫&然後進行一些簡單的配置更改。

編輯補充完整的堆棧跟蹤

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1464842' for key 'PRIMARY' 

Trace: 
#0 Z:\XAMPP\htdocs\sites\Providore\lib\Varien\Db\Statement\Pdo\Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array) 
#1 Z:\XAMPP\htdocs\sites\Providore\lib\Zend\Db\Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array) 
#2 Z:\XAMPP\htdocs\sites\Providore\lib\Zend\Db\Adapter\Abstract.php(479): Zend_Db_Statement->execute(Array) 
#3 Z:\XAMPP\htdocs\sites\Providore\lib\Zend\Db\Adapter\Pdo\Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `ma...', Array) 
#4 Z:\XAMPP\htdocs\sites\Providore\lib\Varien\Db\Adapter\Pdo\Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ma...', Array) 
#5 Z:\XAMPP\htdocs\sites\Providore\lib\Zend\Db\Adapter\Abstract.php(574): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `ma...', Array) 
#6 Z:\XAMPP\htdocs\sites\Providore\app\code\core\Mage\Log\Model\Resource\Visitor.php(174): Zend_Db_Adapter_Abstract->insert('mage_log_visito...', Array) 
#7 Z:\XAMPP\htdocs\sites\Providore\app\code\core\Mage\Log\Model\Resource\Visitor.php(108): Mage_Log_Model_Resource_Visitor->_saveVisitorInfo(Object(Fooman_Jirafe_Model_Log_Visitor)) 
#8 Z:\XAMPP\htdocs\sites\Providore\app\code\core\Mage\Core\Model\Resource\Db\Abstract.php(463): Mage_Log_Model_Resource_Visitor->_afterSave(Object(Fooman_Jirafe_Model_Log_Visitor)) 
#9 Z:\XAMPP\htdocs\sites\Providore\app\code\core\Mage\Core\Model\Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Fooman_Jirafe_Model_Log_Visitor)) 
#10 Z:\XAMPP\htdocs\sites\Providore\app\code\core\Mage\Log\Model\Visitor.php(167): Mage_Core_Model_Abstract->save() 
#11 Z:\XAMPP\htdocs\sites\Providore\app\code\core\Mage\Core\Model\App.php(1338): Mage_Log_Model_Visitor->initByRequest(Object(Varien_Event_Observer)) 
#12 Z:\XAMPP\htdocs\sites\Providore\app\code\core\Mage\Core\Model\App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Fooman_Jirafe_Model_Log_Visitor), 'initByRequest', Object(Varien_Event_Observer)) 
#13 Z:\XAMPP\htdocs\sites\Providore\app\Mage.php(447): Mage_Core_Model_App->dispatchEvent('controller_acti...', Array) 
#14 Z:\XAMPP\htdocs\sites\Providore\app\code\core\Mage\Core\Controller\Varien\Action.php(528): Mage::dispatchEvent('controller_acti...', Array) 
#15 Z:\XAMPP\htdocs\sites\Providore\app\code\core\Mage\Core\Controller\Front\Action.php(64): Mage_Core_Controller_Varien_Action->preDispatch() 
#16 Z:\XAMPP\htdocs\sites\Providore\app\code\core\Mage\Core\Controller\Varien\Action.php(408): Mage_Core_Controller_Front_Action->preDispatch() 
#17 Z:\XAMPP\htdocs\sites\Providore\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index') 
#18 Z:\XAMPP\htdocs\sites\Providore\app\code\core\Mage\Core\Controller\Varien\Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) 
#19 Z:\XAMPP\htdocs\sites\Providore\app\code\core\Mage\Core\Model\App.php(354): Mage_Core_Controller_Varien_Front->dispatch() 
#20 Z:\XAMPP\htdocs\sites\Providore\app\Mage.php(683): Mage_Core_Model_App->run(Array) 
#21 Z:\XAMPP\htdocs\sites\Providore\index.php(90): Mage::run('', 'store') 
#22 {main} 
+1

你可以發佈完整的堆棧跟蹤嗎?需要知道哪張桌子和哪個地方不合格... – 2015-02-09 16:50:12

+0

我編輯了我原來的帖子,包括完整的堆棧跟蹤,謝謝 – KarenB 2015-02-10 13:38:28

回答

5

似乎與日誌表的錯誤。你有mage_作爲所有Magento表的前綴,不是嗎?嘗試在你的magento數據庫中運行這個SQL語句(首先備份你的數據庫):

SET foreign_key_checks = 0; 
TRUNCATE mage_log_customer; 
TRUNCATE mage_log_quote; 
TRUNCATE mage_log_summary; 
TRUNCATE mage_log_url; 
TRUNCATE mage_log_url_info; 
TRUNCATE mage_log_visitor; 
TRUNCATE mage_log_visitor_info; 
TRUNCATE mage_log_visitor_online; 
SET foreign_key_checks = 1; 
+0

輝煌,工作就像一個魅力!非常感謝。我清除了所有的var/cache&var/session文件,但沒有想到在db中查看日誌。 – KarenB 2015-02-10 14:07:20

+0

很高興:) – 2015-02-10 14:16:09

相關問題