我在Oracle 11g中有一个存储过程,它会一次又一次地挂起。当发生这种情况时,我也无法重新编译它,我唯一的选择就是杀死SQL Developer进程。我同意该过程确实在不同的表,视图和物化视图中扫描大量记录,但是当没有这样的问题时,返回结果集只需要1-2秒。我已经尝试杀死所有会话甚至重新启动数据库但似乎没有任何帮助。它只是自己修复。我正在发布程序内容,以防您需要查看
create or replace
PROCEDURE SP_STAJ_FOR_AGAPUS(
V_SSN IN NUMBER,
V_WEYEARNEW OUT NUMBER,
V_WEMONTHNEW OUT NUMBER,
V_WEDAYNEW OUT NUMBER,
V_LS_YEAR OUT NUMBER,
V_LS_MONTH OUT NUMBER)
AS
BEGIN
SELECT NVL(TRUNC(MDC.DAY_COUNT / 360),0) WEYEARNEW, NVL(TRUNC(MOD(MDC.DAY_COUNT,360) / 30),0)
WEMONTHNEW, NVL(MOD(MOD( MDC.DAY_COUNT,360),30),0) WEDAYNEW,NVL(LS.LS_YEAR,0)LS_YEAR,NVL(
LS.LS_MONTH,0)LS_MONTH
INTO V_WEYEARNEW,V_WEMONTHNEW,V_WEDAYNEW,V_LS_YEAR,V_LS_MONTH
FROM SSPF_CENTRE.PERSONS PER
LEFT JOIN
( SELECT SSN, SUM(DAY_COUNT) DAY_COUNT FROM
( SELECT SSN, YEAR, AG.CHECK_PERIOD_MDSS(SSN,YEAR) DAY_COUNT FROM
( SELECT SSN, YEAR FROM SSPF_CENTRE.PERSON_ACCOUNTS GROUP BY SSN,YEAR
UNION ALL
SELECT SSN, SPECIAL_YEAR YEAR
FROM SSPF_CENTRE.person_accounts_06
GROUP BY SSN,SPECIAL_YEAR
UNION ALL SELECT
P.COMMON_SSN, PA.YEAR FROM SSPF_CENTRE.PERSON_ACCOUNTS PA, SSPF_CENTRE.PERSONS P
WHERE
--COMMON_SSN = V_SSN AND
PA.SSN = P.SSN(+) AND P.COMMON_SSN <> P.SSN GROUP BY P.COMMON_SSN,PA.YEAR
) GROUP BY SSN,YEAR
) GROUP BY SSN
) MDC ON PER.SSN=MDC.SSN
LEFT JOIN
( SELECT SSN, AG.CALCULATE_YEAR(LS_DAYS) LS_YEAR, AG.CALCULATE_MONTH( LS_DAYS) LS_MONTH FROM
( SELECT SSN, GET_DAYS(SSN) LS_DAYS FROM MAT_SERVICE_NEW GROUP BY SSN
)
) LS ON PER.SSN=LS.SSN
WHERE PER.SSN=V_SSN;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
V_WEYEARNEW:=0;
V_WEMONTHNEW:=0;
V_WEDAYNEW:=0;
V_LS_YEAR:=0;
V_LS_MONTH:=0;
END;
END SP_STAJ_FOR_AGAPUS;
答案 0 :(得分:2)
即使我们坐在可以访问所有工具的服务器上,这种事情也很难诊断出来。远程几乎是不可能的。
但这里有几点意见: