开发者

Inserting Clobs in Oracle with JDBC is very slow

开发者 https://www.devze.com 2023-04-08 12:39 出处:网络
Hi i am trying to insert a clob using the jdbc, through a maven plugin.But it is taking about 10 minutes to insert.This is exceptionally slow, and i was wondering if there was another way to do it.The

Hi i am trying to insert a clob using the jdbc, through a maven plugin. But it is taking about 10 minutes to insert. This is exceptionally slow, and i was wondering if there was another way to do it. The clob needs to have line breaks. My insert is being called from a sql file and it looks like this:

INSERT INTO SCHEMANAME.ATABLENAME VALUES (1,1,'ASTRING','ANOTHERSTRING','STRING WITH LINEBRE开发者_高级运维AKS

BLAH BLAH

BLAH BLAH
BLAH BLAH
BLAH','FINALSTRING',sysdate);


Pull AWR and ADDM reports and see what the insert is waiting on. Take manual snapshots if needed to get several data points to check against.

10 minutes to insert a single row indicates that there is locking/blocking/waiting going on inside your DB.


If you are wondering if there was another way to do it, could you try to insert a null value to the CLOB column at first, and do a update with the CLOB column after the first insert?


The CLOB is certainly not the problem here. The enormously long time of 10 minutes indicates that some sort of time-out is involved. Two of them come to mind:

  • The network connection is unreliable and it takes a long time to transmit a few bytes.
  • Two database sessions are trying to insert or update the same row in Oracle. If the first one is able to do the insert or update but doesn't commit the connection, the second one will be blocked until the first on commits, rolls back or ends the session.

The second one is more likely.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号