Oracle direct-load INSERTs through JDBC?

前提是你 提交于 2019-12-22 06:50:15

问题


Is it possible to do direct-load INSERTs in Oracle through JDBC?

I currently use batched prepared statements (through Spring JDBC), is there any way to make these bypass the redo logs on a NOLOGGING table?

This is with Oracle 11g.


回答1:


There is an APPEND_VALUES hint introduced in 11gR2 for direct path inserts with INSERT...VALUES.

Don't have an 11gR2 instance available to test whether it works with JDBC batch inserts. It is worth a try though.




回答2:


direct path inserts are only possible in a insert into x as select * from y scenario. This can be done using jdbc, no problem. This can not be done with insert and values. This also can not be done when the database in in force logging mode. Most of the times when a standby database in connected, the primary database will be in force logging mode.

As Gary Myers mentioned, since 11gR2 there is the APPEND_VALUES hint. As with the 'old' append hint, it should only be used for bulk inserts.

I hope this helps, Ronald.




回答3:


Does

insert /*+ append */ into desttab select * from srctab 

not work in JDBC ?




回答4:


Use:

INSERT /*+ APPEND_VALUES */ INTO table_name (column1, column2) values (?,?);



回答5:


I was able to use APPEND_VALUES hint with Oracle 12c with JDBC batching. I verified direct path insert happened via Oracle Enterprise manager where explain plan shows Load As Select



来源:https://stackoverflow.com/questions/5185835/oracle-direct-load-inserts-through-jdbc

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