会话处于非活动状态

时间:2019-06-27 08:40:39

标签: sql multithreading oracle shell

我正在运行一个sql查询,以从具有多个线程的表中获取记录。最初,所有线程都处于INACTIVE状态,然后慢慢地开始变为ACTIVE状态。

我已经根据loc在表上创建了HASH分区。

我还为Item,loc列创建了索引。

select item || ',' || loc || ',' || stock_on_hand || ',' || on_order_qty || ',' ||  0 || ',' || in_transit_qtyAS csv
from makro_m_oplcom_stg
where loc = ${loc} and ITEM_INV_IND = 0;

当我在数据库中针对一个位置运行此查询时,只需花费一秒钟的时间来获取记录,但是当我以多线程模式从shell脚本运行它时,我将面临会话进入非活动模式。

这是我的包装脚本。在此内部,我正在调用另一个具有上述查询的shell脚本。

while [ $thread -le $SLOTS ] do 
  sleep 1 
  LOG_MESSAGE "$pgm_name Started by batch_makro_oplcom_process for thread $thread out of $SLOTS by ${USER}"
 ( ksh $pgm_name.ksh $UP $SLOTS $thread 
   if [ $? -ne 0 ]; then 
    LOG_MESSAGE "$pgm_name failed for thread: $thread, check the $pgm_name error file." 
    exit 1 
  else
   LOG_MESSAGE "$pgm_name executed successfully for thread: $thread." fi ) 
  & let thread=thread+1 
done 

0 个答案:

没有答案