如何测试Oracle并行执行的并行度状况

简介:

如何测试Oracle并行执行的并行度状况:

可以通过如下的脚本,来查看要求的并行度,和实际获得的并行度。

脚本来自:

http://askdba.org/weblog/forums/topic/query-to-identify-parallel-slaves/

col username for a12
col module for a10 trunc
col state for a20
col "QC SID" for A6
col SID for a10
col "QC/Slave" for A10
col "ReqDOP" for 999
col "ActDOP" for 999
col "slave set" for  A10
col event for a25 trunc
col action for a20 trunc
col p1text for a20 trunc
col secwait for 99999
col state for a10 trunc
col object for a25 trunc
col command for a15 trunc
set pages 300  lines 300
select
    s.inst_id,
    decode(px.qcinst_id,NULL,s.username,
          ' - '||lower(substr(s.program,length(s.program)-4,4) ) ) "Username",
    decode(px.qcinst_id,NULL, 'QC', '(Slave)') "QC/Slave" ,
    to_char( px.server_set) "Slave Set",
    to_char(s.sid) "SID",
    decode(px.qcinst_id, NULL ,to_char(s.sid) ,px.qcsid) "QC SID",
    px.req_degree "Requested DOP",
   px.degree "Actual DOP",s.module,s.sql_id,s.event,s.status
 from
   gv$px_session px,
   gv$session s
 where
   px.sid=s.sid (+) and
   px.serial#=s.serial# and
   px.inst_id = s.inst_id
order by 2 desc; 

在Oracel 11.2.0.4进行实际测试,有效。

实际例子:

$cat q00.sql

col username for a12
col module for a10 trunc
col state for a20
col "QC SID" for A6
col SID for a10
col "QC/Slave" for A10
col "ReqDOP" for 999
col "ActDOP" for 999
col "slave set" for  A10
col event for a25 trunc
col action for a20 trunc
col p1text for a20 trunc
col secwait for 99999
col state for a10 trunc
col object for a25 trunc
col command for a15 trunc
set pages 300  lines 300
select
   s.inst_id,
   decode(px.qcinst_id,NULL,s.username,
         ' - '||lower(substr(s.program,length(s.program)-4,4) ) ) "Username",
   decode(px.qcinst_id,NULL, 'QC', '(Slave)') "QC/Slave" ,
   to_char( px.server_set) "Slave Set",
   to_char(s.sid) "SID",
   decode(px.qcinst_id, NULL ,to_char(s.sid) ,px.qcsid) "QC SID",
   px.req_degree "Requested DOP",
  px.degree "Actual DOP",s.module,s.sql_id,s.event,s.status
from
  gv$px_session px,
  gv$session s
where
  px.sid=s.sid (+) and
  px.serial#=s.serial# and
  px.inst_id = s.inst_id
order by 2 desc;


==============================
设置参数:

alter system set PARALLEL_MIN_TIME_THRESHOLD=1 scope=spfile;
alter system set PARALLEL_DEGREE_POLICY=auto scope=spfile;

shu immediate
startup


===================================
通过别的Session,查看状况:  <<<<<<<<<<<<<<Requested DOP = 6 、 Actual DOP =6

SQL>@q00.sql

  INST_ID Username     QC/Slave   Slave Set  SID        QC SID Requested DOP Actual DOP MODULE     SQL_ID               EVENT                     STATUS
---------- ------------ ---------- ---------- ---------- ------ ------------- ---------- ---------- -------------------- ------------------------- ------------------------
        1 U1           QC                    125        125                             SQL*Plus   9y3cpa2z9r4zw        SQL*Net message from clie INACTIVE
        1  - p011      (Slave)    2          19         125                6          6 SQL*Plus   9y3cpa2z9r4zw        PX Deq: Execution Msg     INACTIVE
        1  - p010      (Slave)    2          144        125                6          6 SQL*Plus   9y3cpa2z9r4zw        PX Deq: Execution Msg     INACTIVE
        1  - p009      (Slave)    2          33         125                6          6 SQL*Plus   9y3cpa2z9r4zw        PX Deq: Execution Msg     INACTIVE
        1  - p008      (Slave)    2          142        125                6          6 SQL*Plus   9y3cpa2z9r4zw        PX Deq: Execution Msg     INACTIVE
        1  - p007      (Slave)    2          20         125                6          6 SQL*Plus   9y3cpa2z9r4zw        PX Deq: Execution Msg     INACTIVE
        1  - p006      (Slave)    2          139        125                6          6 SQL*Plus   9y3cpa2z9r4zw        PX Deq: Execution Msg     INACTIVE
        1  - p005      (Slave)    1          18         125                6          6 SQL*Plus   9y3cpa2z9r4zw        PX Deq Credit: send blkd  ACTIVE
        1  - p004      (Slave)    1          29         125                6          6 SQL*Plus   9y3cpa2z9r4zw        PX Deq Credit: send blkd  ACTIVE 
        1  - p003      (Slave)    1          143        125                6          6 SQL*Plus   9y3cpa2z9r4zw        PX Deq Credit: send blkd  ACTIVE
        1  - p002      (Slave)    1          141        125                6          6 SQL*Plus   9y3cpa2z9r4zw        PX Deq Credit: send blkd  ACTIVE
        1  - p001      (Slave)    1          21         125                6          6 SQL*Plus   9y3cpa2z9r4zw        PX Deq Credit: send blkd  ACTIVE
        1  - p000      (Slave)    1          140        125                6          6 SQL*Plus   9y3cpa2z9r4zw        PX Deq Credit: send blkd  ACTIVE

13行が選択されました。

SQL>


===================================
修改session 级别并行度,再次确认:

alter session force parallel query parallel 3;
select * from dba_segments,dba_extents;

===================================
通过别的Session,查看状况:  <<<<<  Requested DOP =3 Actual DOP =3

SQL>@q00.sql


  INST_ID Username     QC/Slave   Slave Set  SID        QC SID Requested DOP Actual DOP MODULE     SQL_ID               EVENT                     STATUS
---------- ------------ ---------- ---------- ---------- ------ ------------- ---------- ---------- -------------------- ------------------------- ------------------------
        1 U1           QC                    125        125                             SQL*Plus   9y3cpa2z9r4zw        SQL*Net message from clie INACTIVE
        1  - p005      (Slave)    2          20         125                3          3 SQL*Plus   9y3cpa2z9r4zw        PX Deq: Execution Msg     INACTIVE
        1  - p004      (Slave)    2          21         125                3          3 SQL*Plus   9y3cpa2z9r4zw        PX Deq: Execution Msg     INACTIVE
        1  - p003      (Slave)    2          144        125                3          3 SQL*Plus   9y3cpa2z9r4zw        PX Deq: Execution Msg     INACTIVE
        1  - p002      (Slave)    1          140        125                3          3 SQL*Plus   9y3cpa2z9r4zw        PX Deq Credit: send blkd  ACTIVE
        1  - p001      (Slave)    1          19         125                3          3 SQL*Plus   9y3cpa2z9r4zw        PX Deq Credit: send blkd  ACTIVE
        1  - p000      (Slave)    1          148        125                3          3 SQL*Plus   9y3cpa2z9r4zw        PX Deq Credit: send blkd  ACTIVE

SQL>

===================================
修改session 级别并行度,再次确认:
alter session force parallel query parallel 8;

select * from dba_segments,dba_extents;


===================================
通过别的Session,查看状况: <<<<<  Requested DOP = 8 Actual DOP =8 

  INST_ID Username     QC/Slave   Slave Set  SID        QC SID Requested DOP Actual DOP MODULE     SQL_ID               EVENT                     STATUS
---------- ------------ ---------- ---------- ---------- ------ ------------- ---------- ---------- -------------------- ------------------------- ------------------------
        1 U1           QC                    125        125                             SQL*Plus   9y3cpa2z9r4zw        SQL*Net message from clie INACTIVE
        1  - p015      (Slave)    2          153        125                8          8 SQL*Plus   9y3cpa2z9r4zw        PX Deq: Execution Msg     INACTIVE
        1  - p014      (Slave)    2          23         125                8          8 SQL*Plus   9y3cpa2z9r4zw        PX Deq: Execution Msg     INACTIVE
        1  - p013      (Slave)    2          154        125                8          8 SQL*Plus   9y3cpa2z9r4zw        PX Deq: Execution Msg     INACTIVE
        1  - p012      (Slave)    2          29         125                8          8 SQL*Plus   9y3cpa2z9r4zw        PX Deq: Execution Msg     INACTIVE
        1  - p011      (Slave)    2          18         125                8          8 SQL*Plus   9y3cpa2z9r4zw        PX Deq: Execution Msg     INACTIVE
        1  - p010      (Slave)    2          141        125                8          8 SQL*Plus   9y3cpa2z9r4zw        PX Deq: Execution Msg     INACTIVE
        1  - p009      (Slave)    2          33         125                8          8 SQL*Plus   9y3cpa2z9r4zw        PX Deq: Execution Msg     INACTIVE
        1  - p008      (Slave)    2          142        125                8          8 SQL*Plus   9y3cpa2z9r4zw        PX Deq: Execution Msg     INACTIVE
        1  - p007      (Slave)    1          31         125                8          8 SQL*Plus   9y3cpa2z9r4zw        PX Deq Credit: send blkd  ACTIVE
        1  - p006      (Slave)    1          139        125                8          8 SQL*Plus   9y3cpa2z9r4zw        PX Deq Credit: send blkd  ACTIVE
        1  - p005      (Slave)    1          21         125                8          8 SQL*Plus   9y3cpa2z9r4zw        PX Deq Credit: send blkd  ACTIVE
        1  - p004      (Slave)    1          20         125                8          8 SQL*Plus   9y3cpa2z9r4zw        PX Deq Credit: send blkd  ACTIVE
        1  - p003      (Slave)    1          144        125                8          8 SQL*Plus   9y3cpa2z9r4zw        PX Deq Credit: send blkd  ACTIVE
        1  - p002      (Slave)    1          148        125                8          8 SQL*Plus   9y3cpa2z9r4zw        PX Deq Credit: send blkd  ACTIVE
        1  - p001      (Slave)    1          26         125                8          8 SQL*Plus   9y3cpa2z9r4zw        PX Deq Credit: send blkd  ACTIVE
        1  - p000      (Slave)    1          143        125                8          8 SQL*Plus   9y3cpa2z9r4zw        PX Deq Credit: send blkd  ACTIVE

SQL>






本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/p/7568033.html,如需转载请自行联系原作者

目录
相关文章
|
7月前
|
Oracle 关系型数据库 MySQL
使用崖山YMP 迁移 Oracle/MySQL 至YashanDB 23.2 验证测试
这篇文章是作者尚雷关于使用崖山YMP迁移Oracle/MySQL至YashanDB 23.2的验证测试分享。介绍了YMP的产品信息,包括架构、版本支持等,还详细阐述了外置库部署、YMP部署、访问YMP、数据源管理、任务管理(创建任务、迁移配置、离线迁移、校验初始化、一致性校验)及MySQL迁移的全过程。
|
SQL 监控 Oracle
关系型数据库Oracle并行执行
【7月更文挑战第12天】
344 14
|
11月前
|
Web App开发 数据库 索引
Playwright 测试并行性
Playwright 测试并行性
399 0
|
SQL Oracle 关系型数据库
|
SQL Oracle 关系型数据库
关系型数据库Oracle并行查询
【7月更文挑战第12天】
359 15
|
Oracle 关系型数据库 数据处理
|
SQL 监控 Oracle
|
监控 Oracle 关系型数据库
关系型数据库Oracle恢复测试
【7月更文挑战第20天】
258 7
|
SQL Oracle 关系型数据库
|
SQL 监控 Oracle

热门文章

最新文章

推荐镜像

更多