标签:结构 eject 数据 mina table password one for循环 而且
尝试OUTFIle、INFILE快速导入导出数据(一个for循环定义自己需要操作的数据库名称,把数据导入到/data/tmp目录下)
for table in `echo oat_inventory_in oat_inventory_out oat_inventory_defective_out oat_reject oat_reject_line oat_goods oat_goods_related oat_order oat_order_line oat_purchase oat_purchase_line oat_invcheck oat_inventory_deal oat_stage_invent oat_inventory oat_receives oat_withdraw oat_deduct oat_order_provide_amount oat_order_coordinate oat_order_distribution oat_refund oat_entity_amount oat_stage_entityfund oat_entity_frozen_detail oat_entity oat_funds_detail`
do
echo $table
mysql -u root -pPassword dbname -e "select * into outfile ‘/data/tmp/$table.txt‘ fields terminated by ‘,‘ from $table;"
done
(因为上述只是倒入数据,而表的结构则需要使用mysqldump方式去导出)
/usr/local/mysql/bin/mysqldump -u root -pPassword -d dbname oat_inventory_in oat_inventory_out oat_inventory_defective_out oat_reject oat_reject_line oat_goods oat_goods_related oat_order oat_order_line oat_purchase oat_purchase_line oat_invcheck oat_inventory_deal oat_stage_invent oat_inventory oat_receives oat_withdraw oat_deduct oat_order_provide_amount oat_order_coordinate oat_order_distribution oat_refund oat_entity_amount oat_stage_entityfund oat_entity_frozen_detail oat_entity oat_funds_detail > struct.sql
scp -P 22 /data/tmp/*.gz chenmingle@192.168.1.1:/data
mysql -u root -pPassword dbname < struct.sql
for table in `echo oat_inventory_out oat_inventory_defective_out oat_reject oat_reject_line oat_goods oat_goods_related oat_order oat_order_line oat_purchase oat_purchase_line oat_invcheck oat_inventory_deal oat_stage_invent oat_inventory oat_receives oat_withdraw oat_deduct oat_order_provide_amount oat_order_coordinate oat_order_distribution oat_refund oat_entity_amount oat_stage_entityfund oat_entity_frozen_detail oat_entity oat_funds_detail`
do
echo $table
mysql -u root -pPassword dbname -e "LOAD DATA INFILE ‘/home/tmp/$table.txt‘ INTO TABLE $table FIELDS TERMINATED BY ‘,‘"
done
标签:结构 eject 数据 mina table password one for循环 而且
原文地址:http://blog.51cto.com/legehappy/2160274