Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Transfer data from MySQL to Oracle
Bing Du Test wrote:
> Ed Prochak wrote:
>
>
>>Bing Du Test wrote: >> >>>What do people usually use to transfer a large number (e.g. 150,000) >>>from one kind of database (e.g. MySQL) to another (e.g. Oracle)? Thanks >>>in advance for any ideas and pointers. >>> >>>Bing >>> >> >>depends. 8^) >> >>How big is the source DB? Is that "large number" refering to the number of >>records? (in which case 150,000 is small) or the number of tables? (man that's >>BIG) >>
>>how complex is the source data model? (many tables realtions?? will the model >>remain the same in Oracle??) >>
ORACLE's DATE type stores the timestamp in an internal format. You decide how it appears when you SELECT that field. It looks like the MySQL format you have is year/month/day/hours/minutes/seconds. On a SELECT query, you tell oralce that's the format you want
SELECT to_char(TAMUBPPSTUDENTLASTSEEN, 'YYYYMMDDHHMISS')
FROM lastseen;
This would affect how you insert/update the date data also
UPDATE lastseen
set TAMUBPPSTUDENTLASTSEEN = to_date('20030326072839', 'YYYYMMDDHHMISS')
where ssn = '987654321' ;
internally Oracle Dates are numeric and record down to a fraction of a second.
>
>
>>Some suggestions include >> >>brute force method: Dump the source DB to text files and load the Oracle DB >>with a combination of SQL*Loader, SQL and PL/SQL, remapping the data to tables >>as needed. >> >>Program method: use PERL and DBI to connect to both databases and move the >>data, performing any transformations needed along the way. >>
For a load this small, performance really isn't an issue. And your tables map one-to-one on the fields, so I'd use the SQL*Loader. It's just a two step process:
Step ONE
from MySQL modify any settings for line layout, field separators, etc and any settings needed to redirect the result to a file and run the query: SELECT * from lastseen;
Step TWO
Build a SQL*Loader control file to handle the layout. run the loader with that layout and the file from step one.
Step THREE
Done
>
>
>>Oracle method: use the Heterogenous services to connect from Oracle to the >>MySQl DB and move the data, performing any transformations using SQL, PL/SQL. >>
I haven't played with that option actually. The probably do. Try to do a GOOGLE search on this group for some discussion of it in the last few months.
>
> Bing
>
>
Thanks for the easy questions!
-- Ed Prochak running http://www.faqs.org/faqs/running-faq/ netiquette http://www.psg.com/emily.html -- "Two roads diverged in a wood and I I took the one less travelled by and that has made all the difference." robert frostReceived on Thu Apr 17 2003 - 23:22:24 CDT