Data migration practices

Source: Internet
Author: User

Winning record side

Data Volume: Tens

Implementation scenario: Database level migration, new data one by one match

Implementation scripts:

1, SQL sorting out the data needs to be exported:

Select A,b,c,d,e,f,g
 from Table_1 
                to outfile '/data/aaa/haha.csv ' fields
terminated by ', ' optionally Enclosed by ' \ '
lines terminated by ' \ r \ n ';
 

2, the use of shell segmentation record results, batch Import

Split-a 3-l 20000 haha.csv target/table2_ for
  
i to ' ls-1 target '
do
    mysql-s-n-p ' xxxxxxx ' Dpemidas-e ' L Oad data infile '/data/aaa/target/$i '
IGNORE into table table2 fields terminated
by ', '  optionally enclosed By ' \ ' '
lines terminated by ' \ r \ n '
    mv/data/aaa/target/$i/data/aaa/complete/sleep
    1
done


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.