Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Copy table data from one database to another with table partitions and references

NitinKalraJul 21 2016 — edited Jul 22 2016

Hi Guys,

Need your help.

I have 4-5 different tables in Oracle database(11g). I have to copy the data from all these tables from there(1st DB) to another database(2nd DB). Source database is having partitioned tables and data in one table could be linked/reference to another row in another table like foreign key.

I am trying to create a procedure, reason being : I need to schedule a job from Java program which will run at sometime and will execute this procedure which will copy the data from 1st database to 2nd database(with all partitions and references)

After the data is copied, I need to delete the data from 1st database so that the space could be recovered.

The data to be copied will be based on condition like copy all data older than 1 year for which I have written the SQL as

select * from schema1.table1 where last_updt_ts < add_months(SYSDATE, -12);

Basically, its a database archiving thing and I need to achieve it through mix of Java job scheduling and a stored procedure.

Source and Destination dB would be Oracle. But I also have to test this between Oracle(source) and MySql(destination).

Can anyone please give me some pointers?

Thanks

Nitin

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 19 2016
Added on Jul 21 2016
11 comments
2,666 views