title: Copy table having millions of records from one database to another - Spring Boot + Spring JDBC
body: <p>Working on a small example where have to copy millions of records from 
  teradata database to Oracle DB. </p>
  
  <p>Environment: Spring Boot + Spring JDBC (jdbcTemplate) + Spring REST + Spring Scheduler + Maven + Oracle + Teradata</p>
  
  <p>Using Spring JDBC's batchUpdate to insert data into target Database Oracle.</p>
  
  <p>Using teradata's 'top 1000' in SQL query from source database. </p>
  
  <pre><code>fecthDataResults = repository.queryForList(
                  "select top 1000 A, B, C, D, E from " + schemaName + ".V_X");
  </code></pre>
  
  <p>Querying from a View "V_X".</p>
  
  <p>This View has 40 million records and spring boot application will choke if it runs. </p>
  
  <p>Also inserting into 2 tables (Primary and Backup) in target Oracle DB. </p>
  
  <p><strong>Whats the best way to fetch and load/copy 40 million records making sure that copying was done successfully into 2 tables.</strong> </p>
  
  <p>Spring Scheduler to schedule the batch copy at specified time/interval.
  Spring Rest to invoke copying manually - both of which is achieved. </p>
  
  <p>Any suggestions would be appreciated. </p>
  
  <p>Thanks.</p>