Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

My application is in PHP which by default uses MySQL db. I have connected MySQL & Oracle dbs with PHP.

Now I want to move data from Oracle db into Mysql db through PHP. Is it possible to do? Is it necessary for me to somehow sync between the two databases as we need to have our backup on the Oracle db.

How do I do this with the help of PHP?

share|improve this question
add comment

3 Answers 3

I do not know whether it is possible using PHP or not, I suggest there is a feature named Import External Data of SQLyog to streamline the transfer of data from any ODBC compliant data source to MySQL,

This import mechanism provides powerful and effective features, such as:

Incremental import: Using special SQL statements and Triggers you can perform conditional data import. For example, you can run the import procedure daily and order it only to import data that appeared during the last day.

Import sessions storage for future use: You can save your import session with all its settings and preferences and later use it repeatedly.

Import sessions scheduling: You can order your import session to be scheduled, and SQLyog will automatically create a standard MS Windows scheduled task where you can specify your schedule preferences depending on your needs.

Also you can schedule a job periodically using this tool, give a try I think this will solve your problem.

share|improve this answer
add comment

How about if you export your data to an external script file using MySQL dump (you have the options of exporting only the data and not the sturcture), which can be done through PHP and you run another PHP script of load the data into Oracle using straight PHP or an oracle client.

Instead of using MySQL dump you can also generate an SQL file which contains the records which have changed

You can also schedule the jobs using Cron but the import into Oracle job should happen some time, maybe an hour or two depending on the time it takes to generate the dump file.

share|improve this answer
add comment

One way to do this would be to code it in PHP using a loop. The loop would cycle through each row of each table in the Oracle database. Each loop would execucte a MySQL query to INSERT data in the MySQL table.

If you have a few tables this might be doable, however it could be very tedious if you have a lot of tables.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.