從分割資料庫還原
NOTE
此功能僅適用於Adobe Commerce執行個體。
針對已實作的Adobe Commerce客戶 分割資料庫,下列主題說明如何回覆或移回單一資料庫。 我們建議Adobe Commerce商家目前使用分割資料庫,並計畫升級至2.4.2版,以及稍後檢閱這些步驟和 公告 已計畫淘汰「分割資料庫」時。
從分割資料庫回覆至單一資料庫時,需建立以下專案的備份: magento_quote
和 magento_sales
將資料庫載入單一資料庫之前 magento_main
資料庫。
在此範例中,我們會登入所有安裝在相同主機上的三個資料庫(magento2-mysql
)作為「root」使用者。 您必須將這些值取代為您的資料庫適當的值。
-
建立備份
magento_quote
資料庫:code language-bash mysqldump -h "magento2-mysql" -u root -p magento_quote > ./quote.sql
-
建立備份
magento_sales
資料庫:code language-bash mysqldump -h "magento2-mysql" -u root -p magento_sales > ./sales.sql
-
載入
magento_quote
將資料庫移入magento_main
資料庫:code language-bash mysql -h "magento2-mysql" -u root -p magento_main < ./quote.sql
-
載入
magento_sales
將資料庫移入magento_main
資料庫:code language-bash mysql -h "magento2-mysql" -u root -p magento_main < ./sales.sql
-
放下
magento_sales
資料庫:code language-bash mysql -h "magento2-mysql" -u root -p -e "DROP DATABASE magento_sales;"
-
放下
magento_quote
資料庫:code language-bash mysql -h "magento2-mysql" -u root -p -e "DROP DATABASE magento_quote;"
-
移除的部署設定
checkout
和sales
在connections
和resources
的區段env.php
檔案。 -
還原外部索引鍵:
code language-bash bin/magento setup:upgrade
驗證您的工作
若要驗證您的單一資料庫實作是否正常運作,請執行以下工作,並確認已將資料新增至 magento_main
使用資料庫工具(例如 phpMyAdmin:
- 確認外部索引鍵已還原。 例如,
QUOTE_STORE_ID_STORE_STORE_ID
鍵入quote
資料庫表格。 - 確認客戶可以從店面下訂單。
- 確認在將分割資料庫還原為單一資料庫之前建立的訂單可在Admin中使用。
recommendation-more-help
386822bd-e32c-40a8-81c2-ed90ad1e198c