Home >Database >Mysql Tutorial >How to import mysql into oracle
How to import mysql into oracle: first import the data in the table into a text file and save it; then write the control file, open the document with Notepad, and change the extension to ".ctl" after writing; then use sqlldr to import the text ; Finally, load the control file and import it automatically.
Recommended: "mysql video tutorial"
Import the mysql database oracle:
First method: Use data migration tool
Second method:
1. Import the data in the table into a text file and save it. I am Mysql>select * from my_mysql_table into outfile 'c: /my_tmp.txt';
in the command line mode under win. 2. Write the control file. Open the document with Notepad and change the extension after writing. ctl, the following is the specific content load datainfile 'c:/my_tmp.txt'into table my_ora_tablereplace fields terminated by x'09' (Field 1, Field 2, Field 3,...Field N) Field 1~N is For the Mysql table field data you want to import, you don’t need to write the fields you don’t need.
3. Use sqlldr to import the text c:\>sqlldr ora_usr and press Enter to enter the path and password of the control file. Then load the control file and import it automatically.
After the import is completed, a .log file will be generated. You can check whether your import was successful. If it is not successful, follow the error prompts to find out the reason.
Note:
Before importing text, the table to which data should be written should be built in the Oracle database in advance, and it must be consistent with the data fields to be imported. If you do not know the Mysql table Structure, you can view the SQL for creating the table in Mysql>show create table my_mysql_table; and convert it into executable SQL in Oracle.
The above is the detailed content of How to import mysql into oracle. For more information, please follow other related articles on the PHP Chinese website!