Migrate MySQL Data to Oracle records

Source: Internet
Author: User
Tags sql loader
MySQL: UTF-8 character set Oracle: Al32UTF8 step: 1. Export csv format data from mysql, set default_character_setgbk during export, otherwise garbled 2. Upload

MySQL: UTF-8 character set Oracle: Al32UTF8 step: 1. Export csv format data from mysql, set default_character_set = gbk during export, otherwise garbled 2. Upload

MySQL: UTF-8 character set

Oracle: Al32UTF8

Steps:

1. Export csv data from mysql. When exporting data, set default_character_set = gbk; otherwise, garbled characters will occur.

2. upload to the linux Server (oracle Server) and replace \ r \ n of windows with \ r with the following command:

Sed-I "s/\ r // g" file

3. Convert gbk encoding to utf8 encoding:

Iconv-f gb18030-t UTF-8 file1.txt> file2.txt

4. Compile the SQL loader control file (file. ctl ):

Options (skip = 1)
Load data
CHARACTERSET AL32UTF8
Infile 'terminal.txt'
Badfile 'terminal. err'
Discardfile 'terminal. dis'
Replace into table terminal
Fields terminated by ', 'trailing NULLCOLS
(
Id,
Mobile,
Imsi,
Imei,
Evoketime date "yyyy-mm-dd hh24: mi: ss ",
Province,
City,
Evokenum,
Createtime date "yyyy-mm-dd hh24: mi: ss ",
Project_id,
Carrier,
Ip,
SC,
New_imsi,
New_imei
)

5. Run sqlldr to import data to the oracle database:

Sqlldr user/pass @ db-control = file. ctl

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.