Recently my server team replaced my database and they put our previous Database . So we lost our order details of one day[particular day] . Now the server team give the backup that contain the lost day order details .
Now please tell how can i restore these orders ?
I cannot replace our database with the given backup , because today also we have orders .
Could anyone tell the step by step instruction ?
I Created a new database and uploaded backup .I understand that order are saved in wp_posts, and post meta .
So what i need to do ? , i export the all the order in that date from wp_posts,and post meta as sql file . Then just need to import it in to current database ? It make any problem ?
This case is quite complicated, because as you can guess you have certainly in both databases (in your backup and actual databases) the same orders ID for different orders. When an order is made it populate the database tables "post", "postmeta" (and maybe some extra tables related to woocommerce that some wooCommerce plugins have created).
RETRIEVING THE MISSING DATA :
First in "post" backup table you have to find all "post_id" with a shop_order "post_type", starting at a specific date :
SELECT * FROM 'posts' WHERE 'post_date' > '2016-03-15 00:00:00' AND 'post_type' LIKE 'shop_order' ORDER BY 'post_id' ASC
(you have to set the correct beginning date and hour in here)
With all those post_id you are going to retrieve all the related data in "postmeta" table:
SELECT * FROM 'postmeta' WHERE 'post_id' > 2059 ORDER BY 'meta_id' ASC
(you have to replace post_id "2059" by your corresponding real one… )
PREPARING NEW DATA TO INSERT :
For "posts" table, you will have to shift all the different ID numbers for "post_id", before inserting them in your actual database, with new non existing yet values depending on the IDs already used by your actual database.
For "postmeta" table, you will have to replace all old "post_id" with the new values just generated in your "posts" table.
You will have to put your shop in maintenance mode to avoid new orders (for example with this free Maintenance Mode plugin)
You have to be used to MySQL and i think it's better to test all in a duplicated version of your webshop. Make backups before…
Regards