简体   繁体   English

Oracle PL / SQL-其他团队调用的过程,用于插入数据。 正在从Java调用过程

[英]Oracle PL/SQL - a procedure called by some other team to insert data. Procedure is being called from Java

Contents of procedure - Just two direct insert statements which are inserted through IN parameters. 过程的内容-仅两个通过IN参数插入的直接插入语句。 The procedure will be hit every second when a row has to be inserted. 当必须插入一行时,该过程将每秒执行一次。 It's kind of a recharge. 这是一种补充。 If you recharge, the details will be sent by some other team to us thru java (callable statement). 如果您充值,详细信息将由其他团队通过java(可调用语句)发送给我们。 Normally when CPU is low, for a second we can see 10-15 sessions for that procedure (in v$session) and data will be inserted perfectly. 通常,当CPU不足时,一秒钟我们可以看到该过程的10-15个会话(在v $ session中),并且数据将被完美插入。 When CPU is a bit high, we are able to see 80-90 sessions at once, where every session becomes invalid after 2,3 seconds. 当CPU有点高时,我们可以一次看到80-90个会话,其中每个会话在2,3秒后变为无效。 it takes time to insert and gets timed out eventually in java in other system. 在其他系统中的java中插入需要花费时间,最终会超时。

I hope I made clear on this. 我希望我对此明确。 Is there any other way to rectify this issue. 还有其他方法可以纠正此问题。 Other than thru a procedure. 除了通过一个程序。 I tried with RECORD concept in pl/sql, but nothing happened really. 我尝试在pl / sql中使用RECORD概念,但实际上没有任何反应。

My procedure just looks like this. 我的程序看起来像这样。

create procedure procedure_name (co1 IN varchar , col2 IN vvarchar.... col15 IN varchar)
x varchar2,
y varchar2,
z varchar2,
.
.
.
begin
x:=col1;
y:=col2;
.
.
.
insert into table1 (column1, column2 ,...) values (x,y,z..); commit;

if (x=15) then

insert into table2(column1,column2,..) values (x,y,z); commit;
exception
when others
..
end;

The java connection should be pooled to avoid such inconvenience. Java连接应该被池化以避免这种不便。 Probably your database cannot hold so many connection at a time because memory she has access to is limited. 您的数据库可能一次不能容纳这么多连接,因为她可以访问的内存是有限的。

Depending on your java architecture, you should find out how to pool your connections to avoid having one per user. 根据您的Java体系结构,您应该了解如何合并连接以避免每个用户建立一个连接。 Maybe you can start from here: http://docs.oracle.com/cd/B10500_01/java.920/a96654/connpoca.htm 也许您可以从这里开始: http : //docs.oracle.com/cd/B10500_01/java.920/a96654/connpoca.htm

Otherwise, it looks like your question is for DBA. 否则,您的问题似乎是针对DBA的。 Have you tried asking it on https://dba.stackexchange.com/ ? 您是否尝试过在https://dba.stackexchange.com/上询问它?

Good luck - for now I think you find something to improve your user experience anyway. 祝您好运-现在,我认为您总能找到一些改善用户体验的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM