Customer Data – How to Restore Customer Data from Old Data

backupcustomerimportsql

I have delete all customer from my system

Now i have old a database , i want to restore the customers from this old database

Thus

Customer id and data are not changed

Can i try this

SET FOREIGN_KEY_CHECKS=0;
 ALTER TABLE `customer_address_entity` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_datetime` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_decimal` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_int` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_text` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_varchar` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_datetime` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_decimal` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_int` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_text` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_varchar` AUTO_INCREMENT=1;
ALTER TABLE `tag` AUTO_INCREMENT=1;
ALTER TABLE `tag_relation` AUTO_INCREMENT=1;
ALTER TABLE `tag_summary` AUTO_INCREMENT=1;
ALTER TABLE `tag_properties` AUTO_INCREMENT=1;
ALTER TABLE `wishlist` AUTO_INCREMENT=1;


ALTER TABLE `log_customer` AUTO_INCREMENT=1;**

then import those customer tables from old database**

then set
SET FOREIGN_KEY_CHECKS=1;

Is it good and proper way ? help me?.

Best Answer

If you want to import those tables with the customer and it's entities having the same ID this will be a good way to go about it.

You will have to make sure the tables stated above or empty tho, before you import your old data or you will get duplicate primary keys

Related Topic