We are migrating a legacy project with huge data set (100+ Tables and many of them are 10 million+ records). Few of them are huge (around 100 million).
When we switch the application, we will get only couple of hours to migrate this data to new application which has same tables but slightly different structure (so cannot import or pump).
We are inserting the records as follows:
- Created a DB Link from source to Destination database
- DISABLE all Constraints on destination table (and child tables if any)
- ALTER all indexes as UNUSABLE
- INSERT /+ APPEND NOLOGGING PARALLEL/ INTO destination_table SELECT /*+ PARALLEL */ FROM source_table
- REBUILD all indexes (REBUILD PARALLEL NOLOGGING and then change to NOPARALLEL and LOGGING)
- ENABLE all Constraints on destination table (and child tables if any)
It works well but takes longer to finish (avg 5 mins for around 10 million records). Most of the time is spent in STEP 6 and specially for FOREIGN KEY constraints where both Parent and Child are huge.
How can we optimize the insert performance of our database as described above?