恢复 woocommerce 订单
Restore woocommerce orders
最近我的服务器团队更换了我的数据库,他们把我们以前的数据库。所以我们丢失了一天[特定日期]的订单详细信息。现在服务器团队提供包含丢失日订单详细信息的备份。
现在请告诉我如何恢复这些订单?
我无法用给定的备份替换我们的数据库,因为今天我们也有订单。
谁能告诉我分步说明?
我创建了一个新数据库并上传了备份。我知道订单保存在 wp_posts 和 post 元中。
那我需要做什么? ,我将该日期的所有订单从 wp_posts 和 post 元导出为 sql 文件。然后只需要将它导入到当前数据库?它有什么问题吗?
这种情况非常复杂,因为您可以猜到,在两个数据库(在您的备份数据库和实际数据库中)中,不同订单的订单 ID 是相同的。
下订单后,它会填充数据库 tables "post"、"postmeta"(可能还有一些与 wooCommerce 插件创建的 woocommerce 相关的额外 tables)。
检索丢失的数据:
首先在 "post" backup table 你必须找到所有 "post_id" 与 shop_order "post_type",从特定日期开始:
SELECT * FROM 'posts' WHERE 'post_date' > '2016-03-15 00:00:00' AND 'post_type' LIKE 'shop_order' ORDER BY 'post_id' ASC
(您必须在此处设置正确的开始日期和时间)
有了所有这些 post_id,您将检索 "postmeta" table 中的所有相关数据:
SELECT * FROM 'postmeta' WHERE 'post_id' > 2059 ORDER BY 'meta_id' ASC
(你必须把post_id"2059"换成你对应的真实的...)
正在准备要插入的新数据:
对于 "posts" table,您必须移动 "post_id" 的所有不同 ID 号,然后再将它们插入您的实际数据库,新的不存在的值取决于已经使用的 ID您的实际数据库。
对于 "postmeta" table,您必须用刚刚在 "posts" table 中生成的新值替换所有旧的 "post_id"。
您必须将您的商店置于维护模式以避免新订单(例如使用这个免费的 Maintenance Mode 插件)
您必须习惯 MySQL 并且我认为最好在您的网上商店的复制版本中测试所有内容。 在……之前进行备份
EDIT
Your website and your database are quiet heavy as you say in this wordpress.stackexchange post 10 Gb for your website and 2 Gb for the database.
THE QUICKEST AND EASY WAY:
So may be the best option is to create a new database on the same server importing the backup with the missed orders. Once done you can do the steps below
1) Put your webshop in maintenance mode (for example with this free Maintenance Mode plugin).
2) Make a backup of your database (just in case).
3) in your wp-config.php file change the database (to the old one with missed orders).
4) Immediately activate and Enable Maintenance Mode plugin.
5) Install WooCommerce Simply Order Export plugin and enable it.
6) Export your one day missing orders data as CSV or XML file.
7) in your wp-config.php file change the database (to the actual one with all new orders).
8) Enable WooCommerce Simply Order Export and import the CSV (or XML) file.
8) Disable WooCommerce Simply Order Export and Maintenance Mode plugins (and delete them if you want).
You are done!
Thanks to Mehul Gohil in that post
此致
最近我的服务器团队更换了我的数据库,他们把我们以前的数据库。所以我们丢失了一天[特定日期]的订单详细信息。现在服务器团队提供包含丢失日订单详细信息的备份。
现在请告诉我如何恢复这些订单?
我无法用给定的备份替换我们的数据库,因为今天我们也有订单。
谁能告诉我分步说明?
我创建了一个新数据库并上传了备份。我知道订单保存在 wp_posts 和 post 元中。
那我需要做什么? ,我将该日期的所有订单从 wp_posts 和 post 元导出为 sql 文件。然后只需要将它导入到当前数据库?它有什么问题吗?
这种情况非常复杂,因为您可以猜到,在两个数据库(在您的备份数据库和实际数据库中)中,不同订单的订单 ID 是相同的。 下订单后,它会填充数据库 tables "post"、"postmeta"(可能还有一些与 wooCommerce 插件创建的 woocommerce 相关的额外 tables)。
检索丢失的数据:
首先在 "post" backup table 你必须找到所有 "post_id" 与 shop_order "post_type",从特定日期开始:
SELECT * FROM 'posts' WHERE 'post_date' > '2016-03-15 00:00:00' AND 'post_type' LIKE 'shop_order' ORDER BY 'post_id' ASC
(您必须在此处设置正确的开始日期和时间)
有了所有这些 post_id,您将检索 "postmeta" table 中的所有相关数据:
SELECT * FROM 'postmeta' WHERE 'post_id' > 2059 ORDER BY 'meta_id' ASC
(你必须把post_id"2059"换成你对应的真实的...)
正在准备要插入的新数据:
对于 "posts" table,您必须移动 "post_id" 的所有不同 ID 号,然后再将它们插入您的实际数据库,新的不存在的值取决于已经使用的 ID您的实际数据库。
对于 "postmeta" table,您必须用刚刚在 "posts" table 中生成的新值替换所有旧的 "post_id"。
您必须将您的商店置于维护模式以避免新订单(例如使用这个免费的 Maintenance Mode 插件)
您必须习惯 MySQL 并且我认为最好在您的网上商店的复制版本中测试所有内容。 在……之前进行备份
EDIT
Your website and your database are quiet heavy as you say in this wordpress.stackexchange post 10 Gb for your website and 2 Gb for the database.
THE QUICKEST AND EASY WAY:
So may be the best option is to create a new database on the same server importing the backup with the missed orders. Once done you can do the steps below
1) Put your webshop in maintenance mode (for example with this free Maintenance Mode plugin).
2) Make a backup of your database (just in case).
3) in your wp-config.php file change the database (to the old one with missed orders).
4) Immediately activate and Enable Maintenance Mode plugin.
5) Install WooCommerce Simply Order Export plugin and enable it.
6) Export your one day missing orders data as CSV or XML file.
7) in your wp-config.php file change the database (to the actual one with all new orders).
8) Enable WooCommerce Simply Order Export and import the CSV (or XML) file.
8) Disable WooCommerce Simply Order Export and Maintenance Mode plugins (and delete them if you want).
You are done!
Thanks to Mehul Gohil in that post
此致