oracle 查看任务数量,关于dbms_scheduler创建任务数量的疑问
本帖最后由 cszxheap 于 2015-3-19 17:52 編輯
首先確認(rèn)系統(tǒng)版本號
SQL> select * from v$version;
BANNER? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? CON_ID
-------------------------------------------------------------------------------- ----------
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production? ?? ?? ?? ???0
PL/SQL Release 12.1.0.2.0 - Production? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? 0
CORE? ? 12.1.0.2.0? ?? ?Production? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? 0
TNS for Linux: Version 12.1.0.2.0 - Production? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???0
NLSRTL Version 12.1.0.2.0 - Production? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? 0
Elapsed: 00:00:00.01
SQL> show user
USER is "SEAN"
SQL> SQL> CREATE OR REPLACE PROCEDURE sp_abc --計劃任務(wù)執(zhí)行的過程
AS
BEGIN
dbms_output.put_line('BEGIN:'||to_char(SYSDATE,'HH24:MI:SS'));
dbms_lock.sleep(2);
dbms_output.put_line('END:'||to_char(SYSDATE,'HH24:MI:SS'));
END;??2? ? 3? ? 4? ? 5? ? 6? ? 7
8??/
Procedure created.
Elapsed: 00:00:00.02
我們開始執(zhí)行100個并發(fā)任務(wù)。。。。
SQL>? ?2? ?? ?-- Local variables here
3? ?? ?i INTEGER;
4
5
12? ?? ?v_jobname VARCHAR2(100);
BEGIN
13? ?14? ?? ?-- Test statements here
15? ?? ?FOR x IN 1 .. 100
16? ?? ?LOOP
17? ?? ?? ? --制定任務(wù)
18? ?? ?? ? SELECT 'SEAN_' || lpad(x, 3, '0') INTO v_jobname FROM dual;
19? ?? ?? ? dbms_output.put_line(v_jobname);
20? ?? ?? ? dbms_scheduler.create_job(job_name? ?=> v_jobname,
21? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?job_type? ?=> 'stored_procedure',
22? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?job_action => 'sp_abc',
23? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?enabled? ? => TRUE);
24
25? ?? ?END LOOP;
26??END;
27??/
SEAN_001
SEAN_002
..
SEAN_099
SEAN_100
PL/SQL procedure successfully completed.
查看系統(tǒng)設(shè)置參數(shù)。。。。
Elapsed: 00:00:00.20
SQL> show parameter job
NAME? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?TYPE? ?? ???VALUE
------------------------------------ ----------- ------------------------------
job_queue_processes? ?? ?? ?? ?? ?? ?integer? ???1000
到這里,任務(wù)創(chuàng)建并開始執(zhí)行,后臺job進(jìn)程數(shù)設(shè)置為1000,然后我們?nèi)ハ到y(tǒng)看看進(jìn)程數(shù),發(fā)現(xiàn)
[oracle@cfx-db1:/home/oracle]$ps -fu oracle | grep ora_j | grep -v grep
oracle? ? 65512? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j000_cfxdba
oracle? ? 65516? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j001_cfxdba
oracle? ? 65520? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j002_cfxdba
oracle? ? 65524? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j003_cfxdba
oracle? ? 65528? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j004_cfxdba
oracle? ? 65532? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j005_cfxdba
oracle? ? 65536? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j006_cfxdba
oracle? ? 65540? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j007_cfxdba
[oracle@cfx-db1:/home/oracle]$ps -fu oracle | grep ora_j | grep -v grep
oracle? ? 65512? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j000_cfxdba
oracle? ? 65516? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j001_cfxdba
oracle? ? 65520? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j002_cfxdba
oracle? ? 65524? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j003_cfxdba
oracle? ? 65528? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j004_cfxdba
oracle? ? 65532? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j005_cfxdba
oracle? ? 65536? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j006_cfxdba
oracle? ? 65540? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j007_cfxdba
[oracle@cfx-db1:/home/oracle]$ps -fu oracle | grep ora_j | grep -v grep
oracle? ? 65512? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j000_cfxdba
oracle? ? 65516? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j001_cfxdba
oracle? ? 65520? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j002_cfxdba
oracle? ? 65524? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j003_cfxdba
oracle? ? 65528? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j004_cfxdba
oracle? ? 65532? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j005_cfxdba
oracle? ? 65536? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j006_cfxdba
oracle? ? 65540? ?? ?1??0 09:31 ?? ?? ???00:00:00 ora_j007_cfxdba
單位時間內(nèi)最多只有8個job進(jìn)程在工作,然后看看日志
SELECT s.owner,
s.job_name,
s.req_start_date,
s.actual_start_date,
s.actual_start_date-s.req_start_date,
s.run_duration
FROM dba_scheduler_job_run_details s
ORDER BY s.JOB_NAME DESC;
OWNER? ?? ???JOB_NAME? ?? ???REQ_START_DATE? ?? ???ACTUAL_START_DATE? ?? ???S.ACTUAL_START_DATE-S.REQ_STAR? ?? ???RUN_DURATION
1? ?? ???SEAN? ?? ???SEAN_100? ?? ???19-3月 -15 09.31.56.609939 上午 PRC? ?? ???19-3月 -15 09.33.43.704488 上午 PRC? ?? ???+000000000 00:01:47.094549? ?? ???+000 00:00:05
2? ?? ???SEAN? ?? ???SEAN_099? ?? ???19-3月 -15 09.31.56.607759 上午 PRC? ?? ???19-3月 -15 09.33.43.704622 上午 PRC? ?? ???+000000000 00:01:47.096863? ?? ???+000 00:00:05
3? ?? ???SEAN? ?? ???SEAN_098? ?? ???19-3月 -15 09.31.56.605817 上午 PRC? ?? ???19-3月 -15 09.33.35.479287 上午 PRC? ?? ???+000000000 00:01:38.873470? ?? ???+000 00:00:05
4? ?? ???SEAN? ?? ???SEAN_097? ?? ???19-3月 -15 09.31.56.603942 上午 PRC? ?? ???19-3月 -15 09.33.35.477664 上午 PRC? ?? ???+000000000 00:01:38.873722? ?? ???+000 00:00:05
5? ?? ???SEAN? ?? ???SEAN_096? ?? ???19-3月 -15 09.31.56.601962 上午 PRC? ?? ???19-3月 -15 09.33.35.477651 上午 PRC? ?? ???+000000000 00:01:38.875689? ?? ???+000 00:00:05
6? ?? ???SEAN? ?? ???SEAN_095? ?? ???19-3月 -15 09.31.56.599939 上午 PRC? ?? ???19-3月 -15 09.33.35.477781 上午 PRC? ?? ???+000000000 00:01:38.877842? ?? ???+000 00:00:05
7? ?? ???SEAN? ?? ???SEAN_094? ?? ???19-3月 -15 09.31.56.597746 上午 PRC? ?? ???19-3月 -15 09.33.35.477789 上午 PRC? ?? ???+000000000 00:01:38.880043? ?? ???+000 00:00:05
8? ?? ???SEAN? ?? ???SEAN_093? ?? ???19-3月 -15 09.31.56.595880 上午 PRC? ?? ???19-3月 -15 09.33.35.477724 上午 PRC? ?? ???+000000000 00:01:38.881844? ?? ???+000 00:00:05
9? ?? ???SEAN? ?? ???SEAN_092? ?? ???19-3月 -15 09.31.56.594021 上午 PRC? ?? ???19-3月 -15 09.33.35.477645 上午 PRC? ?? ???+000000000 00:01:38.883624? ?? ???+000 00:00:05
10? ?? ???SEAN? ?? ???SEAN_091? ?? ???19-3月 -15 09.31.56.592154 上午 PRC? ?? ???19-3月 -15 09.33.30.160901 上午 PRC? ?? ???+000000000 00:01:33.568747? ?? ???+000 00:00:05
11? ?? ???SEAN? ?? ???SEAN_090? ?? ???19-3月 -15 09.31.56.590239 上午 PRC? ?? ???19-3月 -15 09.33.30.160508 上午 PRC? ?? ???+000000000 00:01:33.570269? ?? ???+000 00:00:05
12? ?? ???SEAN? ?? ???SEAN_089? ?? ???19-3月 -15 09.31.56.588048 上午 PRC? ?? ???19-3月 -15 09.33.30.160469 上午 PRC? ?? ???+000000000 00:01:33.572421? ?? ???+000 00:00:05
13? ?? ???SEAN? ?? ???SEAN_088? ?? ???19-3月 -15 09.31.56.586082 上午 PRC? ?? ???19-3月 -15 09.33.30.160523 上午 PRC? ?? ???+000000000 00:01:33.574441? ?? ???+000 00:00:05
14? ?? ???SEAN? ?? ???SEAN_087? ?? ???19-3月 -15 09.31.56.584224 上午 PRC? ?? ???19-3月 -15 09.33.30.160527 上午 PRC? ?? ???+000000000 00:01:33.576303? ?? ???+000 00:00:05
15? ?? ???SEAN? ?? ???SEAN_086? ?? ???19-3月 -15 09.31.56.582344 上午 PRC? ?? ???19-3月 -15 09.33.30.160394 上午 PRC? ?? ???+000000000 00:01:33.578050? ?? ???+000 00:00:05
16? ?? ???SEAN? ?? ???SEAN_085? ?? ???19-3月 -15 09.31.56.580443 上午 PRC? ?? ???19-3月 -15 09.33.30.160911 上午 PRC? ?? ???+000000000 00:01:33.580468? ?? ???+000 00:00:05
。。。。。。。。。。。。。
87? ?? ???SEAN? ?? ???SEAN_014? ?? ???19-3月 -15 09.31.56.444196 上午 PRC? ?? ???19-3月 -15 09.32.04.850244 上午 PRC? ?? ???+000000000 00:00:08.406048? ?? ???+000 00:00:05
88? ?? ???SEAN? ?? ???SEAN_013? ?? ???19-3月 -15 09.31.56.442356 上午 PRC? ?? ???19-3月 -15 09.32.04.850291 上午 PRC? ?? ???+000000000 00:00:08.407935? ?? ???+000 00:00:05
89? ?? ???SEAN? ?? ???SEAN_012? ?? ???19-3月 -15 09.31.56.440439 上午 PRC? ?? ???19-3月 -15 09.32.04.850355 上午 PRC? ?? ???+000000000 00:00:08.409916? ?? ???+000 00:00:05
90? ?? ???SEAN? ?? ???SEAN_011? ?? ???19-3月 -15 09.31.56.438361 上午 PRC? ?? ???19-3月 -15 09.32.04.850315 上午 PRC? ?? ???+000000000 00:00:08.411954? ?? ???+000 00:00:05
91? ?? ???SEAN? ?? ???SEAN_010? ?? ???19-3月 -15 09.31.56.436556 上午 PRC? ?? ???19-3月 -15 09.32.04.850355 上午 PRC? ?? ???+000000000 00:00:08.413799? ?? ???+000 00:00:05
92? ?? ???SEAN? ?? ???SEAN_009? ?? ???19-3月 -15 09.31.56.434471 上午 PRC? ?? ???19-3月 -15 09.32.04.849637 上午 PRC? ?? ???+000000000 00:00:08.415166? ?? ???+000 00:00:05
93? ?? ???SEAN? ?? ???SEAN_008? ?? ???19-3月 -15 09.31.56.432617 上午 PRC? ?? ???19-3月 -15 09.32.04.849642 上午 PRC? ?? ???+000000000 00:00:08.417025? ?? ???+000 00:00:05
94? ?? ???SEAN? ?? ???SEAN_007? ?? ???19-3月 -15 09.31.56.430785 上午 PRC? ?? ???19-3月 -15 09.31.56.627770 上午 PRC? ?? ???+000000000 00:00:00.196985? ?? ???+000 00:00:05
95? ?? ???SEAN? ?? ???SEAN_006? ?? ???19-3月 -15 09.31.56.428984 上午 PRC? ?? ???19-3月 -15 09.31.56.600048 上午 PRC? ?? ???+000000000 00:00:00.171064? ?? ???+000 00:00:05
96? ?? ???SEAN? ?? ???SEAN_005? ?? ???19-3月 -15 09.31.56.427186 上午 PRC? ?? ???19-3月 -15 09.31.56.613400 上午 PRC? ?? ???+000000000 00:00:00.186214? ?? ???+000 00:00:05
97? ?? ???SEAN? ?? ???SEAN_004? ?? ???19-3月 -15 09.31.56.425017 上午 PRC? ?? ???19-3月 -15 09.31.56.585836 上午 PRC? ?? ???+000000000 00:00:00.160819? ?? ???+000 00:00:05
98? ?? ???SEAN? ?? ???SEAN_003? ?? ???19-3月 -15 09.31.56.423124 上午 PRC? ?? ???19-3月 -15 09.31.56.571928 上午 PRC? ?? ???+000000000 00:00:00.148804? ?? ???+000 00:00:05
99? ?? ???SEAN? ?? ???SEAN_002? ?? ???19-3月 -15 09.31.56.421122 上午 PRC? ?? ???19-3月 -15 09.31.56.555690 上午 PRC? ?? ???+000000000 00:00:00.134568? ?? ???+000 00:00:05
100? ?? ???SEAN? ?? ???SEAN_001? ?? ???19-3月 -15 09.31.56.419074 上午 PRC? ?? ???19-3月 -15 09.31.56.438919 上午 PRC? ?? ???+000000000 00:00:00.019845? ?? ???+000 00:00:05
果然在REQ_START_DATE基本相同的情況下,ACTUAL_START_DATE越來越推遲,每個批次(ACTUAL_START_DATE類似)的數(shù)量也為7個左右
問題來了
1:為何后臺進(jìn)程運參數(shù)設(shè)置為1000,而實際只有8個在并行跑?
2:是否需要考慮設(shè)置scheduler的max_job_slave_process參數(shù)?現(xiàn)在為默認(rèn)值NULL,可是從reference上說明了job_queue_process的值大于0則該參數(shù)無意義
總結(jié)
以上是生活随笔為你收集整理的oracle 查看任务数量,关于dbms_scheduler创建任务数量的疑问的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: .Net JIT
- 下一篇: 华为谷歌互利合作曝光:或将推Nexus手