如何测试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>

如何测试Oracle并行执行的并行度状况的更多相关文章

  1. Oracle并行执行特性应用初探

    1.      序 在历史数据转出测试过程中,通过不断的优化,包括SQL调整和数据库调整,从AWR中看到,基本上难以进行更多的性能提升,于是准备试试并行执行的特性,从这个任务的特点来分析,也比较适合采 ...

  2. 测试Oracle 11gr2 RAC 非归档模式下,offline drop数据文件后的数据库的停止与启动测试全过程

    测试Oracle 11gr2 RAC 非归档模式下,offline drop数据文件后的数据库的停止与启动测试全过程 最近系统出现问题,由于数据库产生的日志量太大无法开启归档模式,导致offline的 ...

  3. windows下怎样测试oracle安装是否成功以及在oracle中创建用户并赋予用户权限;和[Err] ORA-65096: 公用用户名或角色名无效的解决方案

    测试oracle数据安装是否成功,可按顺序执行以下两个步骤: 测试步骤 1:请执行操作系统级的命令:tnsping orcl 上述命令假定全局数据库名是 orcl.以下是命令执行后的示例(请在cmd命 ...

  4. 如何取得Oracle并行执行的trace

    如何取得Oracle并行执行的trace: ALTER SESSION SET tracefile_identifier='10046_PROD';ALTER SESSION SET max_dump ...

  5. LoadRunner调用java函数测试oracle

    LoadRunner调用java函数测试oracle 测试oracle的方法有很多,可以使用loadrunner的oracle协议直接调用oracle进行测试,也可以调用开发的java程序对oracl ...

  6. 测试oracle数据库的脱机备份和恢复

    环境:windows7.Oracle11g 一.脱机备份 脱机备份是指在数据库关闭情况下的数据备份,也称为冷备份. 在书上学到的备份步骤: 1.记录所要备份数据库文件所在的操作系统路径: 2.关闭数据 ...

  7. 测试oracle表空间自动扩展

    2019-04-1116:01:25 表空间分配10m自动扩展,向表中插入数据,看表空间达到10m以后是否会报错. 测试过程如下: 1.创建表空间 CREATE TABLESPACE TEST DAT ...

  8. 启动和测试oracle是否安装成功

    转自:https://www.cnblogs.com/justdo-it/articles/5112576.html 测试步骤1:请执行操作系统级的命令:tnsping orcl 测试步骤 2:请执行 ...

  9. Windows 10 64位操作系统 下安装、配置、启动、登录、连接测试oracle 11g

    一.下载oracle安装包 1:详细下载安装版本可见官网:https://www.oracle.com/technetwork/database/enterprise-edition/download ...

随机推荐

  1. ESLint 使用方法

    一.全局安装 npm install -g eslint 二.生成配置文件 在项目根目录执行init,生成.eslintrc文件.在init时,要求根目录存在package.json.当然也可以直接复 ...

  2. Double Array Trie 的Python实现

    不多介绍,可自行Google,或者其它关键词: "datrie" 放代码链接: double_array_trie.py 因为也是一段学习代码,参考的文章都记在里面了,主要参考gi ...

  3. Oracle EBS 银行账户API

     创建银行 -- Create Bank DECLARE p_init_msg_list VARCHAR2(200); p_country_code VARCHAR2(200); p_bank_nam ...

  4. Oracle EBS 用户职责人员取值

    SELECT fu.user_name 用户名, fu.description 用户说明, fu.start_date 用户启用日期, fu.end_date 用户终止日期 --,fu.employe ...

  5. 简单了解Tomcat与OSGi的类加载器架构

    前言: 本次博客主要是对Tomcat与OSGi的类加载器架构,所以就需要对tomcat.OSGi以及类加载机制有所了解 类加载可以在http://www.cnblogs.com/ghoster/p/7 ...

  6. HTML5 学习总结(三)——本地存储(localStorage、sessionStorage、WebSqlDataBase、IndexedDB)

    HTML5问世以后,前端加入了一个重要的功能,便是本地存储,本地存储可分为4类: Local Storage:总的存储量有所限制,并不能提供真正的检索API,数据的生命期比窗口或浏览器的生命期长,数据 ...

  7. mysql host'XXX' is not allowed to connect to this mysql server

    错误的原因一般是没有添加 IP可远程的权限. 首先以 root 帐户登陆 MySQL 1.在 Windows 主机中点击开始菜单,运行,输入“cmd”,进入控制台,然后cd 进入MySQL 的 bin ...

  8. [BZOJ 4763]雪辉

    [BZOJ 4763] 雪辉 题意 给定一棵 \(n\) 个点的无根树, 点带权. \(q\) 次询问, 每次给定树上的若干路径, 求这些路径上的点共有多少种不同权值以及这些点的权值组成的集合的 \( ...

  9. [python]如何理解uiautomator里面的 right,left,up,down 及使用场景

    关于Android自动化uiautomator 框架,前面有讲在有些场景下,比如需要在设置界面中将某些选项开关打开或者关闭(前提是这些选项和开关的控件(resourceId,className,tex ...

  10. 【Ansible 文档】【译文】Ad-Hoc 命令介绍

    Introduction To Ad-Hoc Commands Ad-Hoc命令介绍 下面的例子展示了如何使用 /usr/bin/ansible 来运行ad hoc任务. 什么是ad hoc命令? 一 ...