0

I have a requirement to export / extract certain rows (matching some query) of some tables from one oracle database and import those rows in the respective tables of other database.

both source and target tables have same schema.

My question is, .Whats the best way to implement this requirement.?

Heard of oracle export data pump utility but I have to extract only certain rows.Or Is there any other way to achive this programmatically.

thanks in advance.

1 Answer 1

1

You can specify your queries per table with the QUERY parameter with Data Pump export. For example:

QUERY=employees:"WHERE department_id > 10 AND salary > 10000"

With the above, only those rows are exported from the employees table, that have department_id > 10 AND salary > 10000.

More information in the official documentation:

http://docs.oracle.com/database/121/SUTIL/dp_export.htm#SUTIL860

Another way to transfer the data: create a database link, and just simply run an INSERT ... SELECT statement.

For example, on the target database:

create database link source connect to username identified by password using 'SOURCE_TNS';
insert into table1 select * from table1@source where ...;
1
  • thank you for your absolute answer..will try this. can this be achieved using JAVA ? Commented Oct 10, 2014 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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