Any suggestions on how to extract 6 million records from an oracle10g?

*爱你&永不变心* 提交于 2019-12-02 04:23:46

Do you need to extract the contents of a single table, or a JOIN result? Does the result have to be ordered? If so, you should first optimize your extraction query.

Once you have an optimal query you can either SELECT directly (e.g. via sqlplus), or write to an external (flat file) table, or use ODI.

6 million rows is not all that much. Just write the query and let the optimizer do its thing. If your statistics are up to date, which is also automatic, it should run just fine. Trying to tweak it will probably make it run slower, unless you have a better understanding of query optimization than the team of engineers at Oracle.

Using only PL/SQL is okay if all your rows are small enough. The UTL_FILE package will restrict you to 32767 characters per line with the PUT_LINE command. There is a way around this, but it requires copying data to a BLOB.

I'd suggest installing either Python and cx_Oracle or Perl and DBD::Oracle. They will happily churn through 6 million rows with no problem. The defaults are set to pull a good size batch of rows to keep network transmissions down.

If you let me know how you want to proceed, I can post some sample code, but googling the documentation for either cx_Oracle or DBD::Oracle will turn up the basics on how to fetch records.

I wrote Java program to write all the record to the file. On my select I had 20 threads and it worked like a dream.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!