Importing mysql Data to oracle

Source: Internet
Author: User

Steps:
1. Export data files from mysql
 
Select sender, imsi, random_code, date_format (token_create_time, '% Y % m % d % H % I % s'), date_format (last_login_time, '% Y % m % d % H % I % s'), 1 as status
From tb_sms_token where last_login_time is not null
Into outfile '/home/mysql/TB_GH_WLAN_TOKEN.dat'
FIELDS
Terminated by '$'
Escaped '\\'
LINES
Terminated by '\ r \ N'
 
Select sender, imsi, random_code, date_format (token_create_time, '% Y % m % d % H % I % s'), date_format (last_login_time, '% Y % m % d % H % I % s'), 1 as status
From tb_sms_token where last_login_time is not null
Into outfile '/home/mysql/TB_GH_WLAN_TOKEN.dat'
FIELDS
Terminated by '$'
Escaped '\\'
LINES
Terminated by '\ r \ N'
 
Each piece of data is separated by line breaks, and fields are separated by $ before.
2. If oracle cannot process fields, convert them using awk or sed in linux.
3. Use the sqlldr command of oracle to import data files. The control file content is as follows:
 
LOAD DATA
INFILE "/home/oracle/TB_GH_WLAN_TOKEN.dat"
APPEND
Into table GAME_HALL_TOKEN_TEMP
Fields terminated by '$'
(Id sequence (max, 1 ),
PHONE_NUMBER, IMSI, TOKEN_VALUE,
CREATE_TIME date "yyyyMMddhh24miss ",
LAST_USE_TIME date "yyyyMMddhh24miss ",
STATUS integer)
 
LOAD DATA
INFILE "/home/oracle/TB_GH_WLAN_TOKEN.dat"
APPEND
Into table GAME_HALL_TOKEN_TEMP
Fields terminated by '$'
(Id sequence (max, 1 ),
PHONE_NUMBER, IMSI, TOKEN_VALUE,
CREATE_TIME date "yyyyMMddhh24miss ",
LAST_USE_TIME date "yyyyMMddhh24miss ",
STATUS integer)
 
For more information about sqlldr usage, see oracle help.
 
Notes:
1. Primary Key Generation
2. Date Format Processing
3. Processing of null values
4. You can import large data volumes without creating an index in the target database. Adding an index after the import should speed up the import.

Related Article

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.