Oracle并行进程小结(二)

2014-11-24 18:40:17 · 作者: · 浏览: 5
the V$SESSTAT table.


查看并行进程的coordinator信息,


可以使用如下两个SQL查询


col username for a12


col "QC SID" for A6


col "SID" for A6


col "QC/Slave" for A8


col "Req. DOP" for 9999


col "Actual DOP" for 9999


col "Slaveset" for A8


col "Slave INST" for A9


col "QC INST" for A6


set pages 300 lines 300


col wait_event format a30


select


decode(px.qcinst_id,NULL,username,' - '||lower(substr(pp.SERVER_NAME,


length(pp.SERVER_NAME)-4,4) ) )"Username",


decode(px.qcinst_id,NULL, 'QC', '(Slave)') "QC/Slave" ,


to_char( px.server_set) "SlaveSet",


to_char(s.sid) "SID",


to_char(px.inst_id) "Slave INST",


decode(sw.state,'WAITING', 'WAIT', 'NOT WAIT' ) as STATE,


case sw.state WHEN 'WAITING' THEN substr(sw.event,1,30) ELSE NULL end as wait_event ,


decode(px.qcinst_id, NULL ,to_char(s.sid) ,px.qcsid) "QC SID",


to_char(px.qcinst_id) "QC INST",


px.req_degree "Req. DOP",


px.degree "Actual DOP"


from gv$px_session px,


gv$session s ,


gv$px_process pp,


gv$session_wait sw


where px.sid=s.sid (+)


and px.serial#=s.serial#(+)


and px.inst_id = s.inst_id(+)


and px.sid = pp.sid (+)


and px.serial#=pp.serial#(+)


and sw.sid = s.sid


and sw.inst_id = s.inst_id


order by


decode(px.QCINST_ID, NULL, px.INST_ID, px.QCINST_ID),


px.QCSID,


decode(px.SERVER_GROUP, NULL, 0, px.SERVER_GROUP),


px.SERVER_SET,


px.INST_ID;



SELECT px.SID "SID", p.PID, p.SPID "SPID", px.INST_ID "Inst",


px.SERVER_GROUP "Group", px.SERVER_SET "Set",


px.DEGREE "Degree", px.REQ_DEGREE "Req Degree", w.event "Wait Event"


FROM GV$SESSION s, GV$PX_SESSION px, GV$PROCESS p, GV$SESSION_WAIT w


WHERE s.sid (+) = px.sid AND s.inst_id (+) = px.inst_id AND


s.sid = w.sid (+) AND s.inst_id = w.inst_id (+) AND


s.paddr = p.addr (+) AND s.inst_id = p.inst_id (+)


ORDER BY DECODE(px.QCINST_ID, NULL, px.INST_ID, px.QCINST_ID), px.QCSID,


DECODE(px.SERVER_GROUP, NULL, 0, px.SERVER_GROUP), px.SERVER_SET, px.INST_ID



查看并行进程的物理读信息


SELECT QCSID, SID, INST_ID "Inst", SERVER_GROUP "Group", SERVER_SET "Set",


NAME "Stat Name", VALUE


FROM GV$PX_SESSTAT A, V$STATNAME B


WHERE A.STATISTIC# = B.STATISTIC# AND NAME LIKE 'PHYSICAL READS'


AND VALUE > 0 ORDER BY QCSID, QCINST_ID, SERVER_GROUP, SERVER_SET;


QCSID SID Inst Group Set Stat Name VALUE


------ ----- ------ ------ ------ ------------------ ----------


9 9 1 physical reads 3863


9 7 1 1 1 physical reads 2


9 21 1 1 1 physical reads 2


9 18 1 1 2 physical reads 2


9 20 1 1 2 physical reads 2



查看系统中与parallel有关的信息


SELECT NAME, VALUE FROM GV$SYSSTAT


WHERE UPPER (NAME) LIKE '%PARALLEL OPERATIONS%'


OR UPPER (NAME) LIKE '%PARALLELIZED%' OR UPPER (NAME) LIKE '%PX%';


NAME VALUE


-------------------------------------------------- ----------


queries parallelized 347


DML statements parallelized 0


DDL statements parallelized 0


DFO trees parallelized 463


Parallel operations not downgraded 28


Parallel operations downgraded to serial 31


Parallel operations downgraded 75 to 99 pct 252


Parallel operations downgraded 50 to 75 pct 128


Parallel oper