我们在从我的一位客户提交工作时遇到了问题。这些工作是“一天结束”过程的一部分。
当我从Java提交DBMS作业时,在“ user_jobs”中检查作业状态后,我同时获得了两个具有相同名称的作业,这将创建阻塞会话和死锁。
但是问题并非一整天都在发生。自上个月以来,它仅发生过3次。
能否请您提供一些有关如何识别此问题的信息?
Oracle版本是11g,它是企业版。
以下过程用于从Java提交作业。
CREATE OR REPLACE FUNCTION submitProcAsJob(p_szJobName VARCHAR2,
p_szInstanceNo VARCHAR2 DEFAULT NULL) RETURN NUMBER IS
m_iJobNo NUMBER;
m_iInstanceNo NUMBER;
BEGIN
BEGIN
m_iInstanceNo := To_Number(TRIM(p_szInstanceNo));
EXCEPTION WHEN OTHERS THEN
m_iInstanceNo := NULL;
END;
IF m_iInstanceNo IS NOT NULL THEN
DBMS_JOB.SUBMIT(m_iJobNo, p_szJobName, SYSDATE, NULL, FALSE, m_iInstanceNo) ;
ELSE
DBMS_JOB.SUBMIT(m_iJobNo, p_szJobName, SYSDATE, NULL);
END IF;
IF m_iJobNo IS NULL THEN
RAISE_APPLICATION_ERROR(-20002, 'Unable to submit job.');
END IF;
COMMIT ;
RETURN m_iJobNo;
EXCEPTION WHEN OTHERS THEN
RETURN 0;
END;
输入传递给过程:-
p_szJobName :- EOD_UPLOADFINDETAILS_CARD('001','507213',To_Date('20181203', 'yyyyMMdd'),'SYSTEM','001','CARD','N','Y');
p_szInstanceNo :- 1
以下是客户共享的输出
SQL> SELECT job, log_user, schema_user, last_date, this_date, what, broken FROM DBa_jobs where broken='N';
JOB LOG_USER SCHEMA_USER
---------- ------------------------------ ------------------------------
LAST_DATE THIS_DATE
--------- ---------
WHAT
--------------------------------------------------------------------------------
B
-
285712 SYS SYSMAN
05-DEC-18
EMD_MAINTENANCE.EXECUTE_EM_DBMS_JOB_PROCS();
N
JOB LOG_USER SCHEMA_USER
---------- ------------------------------ ------------------------------
LAST_DATE THIS_DATE
--------- ---------
WHAT
--------------------------------------------------------------------------------
B
-
829059 ICSDB ICSDB
04-DEC-18
EOD_UPLOADFINDETAILS_CARD('001','507213',To_Date('20181203', 'yyyyMMdd'),'SYSTEM
','001','CARD','N','Y');
N
JOB LOG_USER SCHEMA_USER
---------- ------------------------------ ------------------------------
LAST_DATE THIS_DATE
--------- ---------
WHAT
--------------------------------------------------------------------------------
B
-
829060 ICSDB ICSDB
04-DEC-18
EOD_UPLOADFINDETAILS_CARD('001','507213',To_Date('20181203', 'yyyyMMdd'),'SYSTEM
','001','CARD','N','Y');
JOB LOG_USER SCHEMA_USER
---------- ------------------------------ ------------------------------
LAST_DATE THIS_DATE
--------- ---------
WHAT
--------------------------------------------------------------------------------
B
-
N
SQL> SELECT * FROM DBA_JOBS_RUNNING;
SID JOB FAILURES LAST_DATE LAST_SEC THIS_DATE THIS_SEC
---------- ---------- ---------- --------- -------- --------- --------
INSTANCE
----------
2661 829060 04-DEC-18 21:46:47
1
2838 829059 04-DEC-18 21:46:47
1